Don’t use another thread if there actually are no sinks for a connection.
[sonitus.git] / src / main / java / net / pterodactylus / sonitus / data / Pipeline.java
index 45d20bf..66ee2e5 100644 (file)
@@ -347,7 +347,7 @@ public class Pipeline implements Iterable<ControlledComponent> {
                public Connection(Source source, Collection<Sink> sinks) {
                        this.source = source;
                        this.sinks = sinks;
-                       if (sinks.size() == 1) {
+                       if (sinks.size() < 2) {
                                executorService = MoreExecutors.sameThreadExecutor();
                        } else {
                                executorService = Executors.newCachedThreadPool();