From: David ‘Bombe’ Roden Date: Thu, 6 Jun 2013 04:36:32 +0000 (+0200) Subject: Store the connections per filter. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=48ff2dfc3ec8aafa119b8e25dade695c5d40312b;p=sonitus.git Store the connections per filter. --- diff --git a/src/main/java/net/pterodactylus/sonitus/data/filter/PipelineFilter.java b/src/main/java/net/pterodactylus/sonitus/data/filter/PipelineFilter.java index 492db5b..638df00 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/filter/PipelineFilter.java +++ b/src/main/java/net/pterodactylus/sonitus/data/filter/PipelineFilter.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.Map; import net.pterodactylus.sonitus.data.AbstractFilter; import net.pterodactylus.sonitus.data.DataPacket; @@ -29,6 +30,7 @@ import net.pterodactylus.sonitus.data.Metadata; import net.pterodactylus.sonitus.data.Pipeline.Connection; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; /** * {@link Filter} that combines several filters into one. @@ -46,6 +48,9 @@ public class PipelineFilter extends AbstractFilter implements Filter { /** The last filter (for convenience). */ private final Filter lastFilter; + /** The connections for each filter. */ + private final Map filterConnections = Maps.newHashMap(); + /** * Creates a new pipeline filter. * @@ -82,6 +87,7 @@ public class PipelineFilter extends AbstractFilter implements Filter { filter.open(currentMetadata); currentMetadata = filter.metadata(); Connection connection = new Connection(currentSource, Arrays.asList(filter)); + filterConnections.put(filter, connection); String threadName = String.format("%s → %s", connection.source().name(), filter.name()); new Thread(connection, threadName).start(); currentSource = filter;