From 6990b0756343c247fe05d6c55d6b7049ad5f8e14 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 16 Mar 2013 18:46:29 +0100 Subject: [PATCH] Access source threadsafely. --- .../java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java | 3 +++ 1 file changed, 3 insertions(+) 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; } -- 2.7.4