From: David ‘Bombe’ Roden Date: Sat, 16 Mar 2013 17:46:29 +0000 (+0100) Subject: Access source threadsafely. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6990b0756343c247fe05d6c55d6b7049ad5f8e14;p=sonitus.git Access source threadsafely. --- diff --git a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java index 57c313e..38e7473 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java +++ b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java @@ -135,9 +135,11 @@ public class MultiSourceFilter implements Filter, ReusableSink { while (true) { /* wait for source to be set. */ OutputStream outputStream; + Source source; logger.finest("Entering synchronized block..."); synchronized (syncObject) { logger.finest("Entered synchronized block."); + source = this.source; while (source == null) { try { logger.finest("Waiting for source to connect..."); @@ -145,6 +147,7 @@ public class MultiSourceFilter implements Filter, ReusableSink { } catch (InterruptedException ie1) { /* ignore, keep waiting. */ } + source = this.source; } outputStream = pipedOutputStream; }