From: David ‘Bombe’ Roden Date: Fri, 24 May 2013 21:04:41 +0000 (+0200) Subject: Use a single thread if a source/filter has only a single sink. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=940ea8e8a65ad0d08fc2938b84a09b0e4c6b518c;p=sonitus.git Use a single thread if a source/filter has only a single sink. --- diff --git a/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java b/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java index d9efcae..93648bc 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java @@ -35,6 +35,7 @@ import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; +import com.google.common.util.concurrent.MoreExecutors; /** * A pipeline is responsible for streaming audio data from a {@link Source} to @@ -234,7 +235,7 @@ public class Pipeline { this.source = source; this.sinks = sinks; if (sinks.size() == 1) { - executorService = Executors.newSingleThreadExecutor(); + executorService = MoreExecutors.sameThreadExecutor(); } else { executorService = Executors.newCachedThreadPool(); }