diff --git a/src/java/com/threerings/presents/client/BlockingCommunicator.java b/src/java/com/threerings/presents/client/BlockingCommunicator.java index b3adfd8a9..39a948ea7 100644 --- a/src/java/com/threerings/presents/client/BlockingCommunicator.java +++ b/src/java/com/threerings/presents/client/BlockingCommunicator.java @@ -684,15 +684,23 @@ public class BlockingCommunicator extends Communicator super("BlockingCommunicator_Writer"); } + @Override + public synchronized void shutdown () + { + // we want to finish off what's in our queue before we actually shutdown + postMessage(new TerminationMessage()); + } + @Override protected void iterate () { // fetch the next message from the queue UpstreamMessage msg = _msgq.get(); - // if this is a termination message, we're being requested to exit, so we want to bail - // now rather than continuing + // if this is a termination message, we're being requested to exit, so we call + // super.shutdown() to mark ourselves as not running and then return if (msg instanceof TerminationMessage) { + super.shutdown(); return; } @@ -719,14 +727,6 @@ public class BlockingCommunicator extends Communicator { writerDidExit(); } - - @Override - protected void kick () - { - // post a bogus message to the outgoing queue to ensure that the writer thread notices - // that it's time to go - postMessage(new TerminationMessage()); - } } /**