From 9434b6e9bcf13d8ac09ed7a623530f02e1c474e0 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 18 Mar 2005 19:26:11 +0000 Subject: [PATCH] Just use a volatile variable and do away with the synchronization, at Mr. Greenwell's suggestion. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3416 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/net/ConnectionManager.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/java/com/threerings/presents/server/net/ConnectionManager.java b/src/java/com/threerings/presents/server/net/ConnectionManager.java index 7b32d9e49..0e3abf9c0 100644 --- a/src/java/com/threerings/presents/server/net/ConnectionManager.java +++ b/src/java/com/threerings/presents/server/net/ConnectionManager.java @@ -119,7 +119,7 @@ public class ConnectionManager extends LoopingThread * action may be specified and it may be cleared by calling this * method with null. */ - public synchronized void setShutdownAction (Runnable onExit) + public void setShutdownAction (Runnable onExit) { _onExit = onExit; } @@ -546,10 +546,7 @@ public class ConnectionManager extends LoopingThread // documentation inherited protected void didShutdown () { - Runnable onExit = null; - synchronized (this) { - onExit = _onExit; - } + Runnable onExit = _onExit; if (onExit != null) { Log.info("Connection Manager thread exited (running onExit)."); onExit.run(); @@ -776,7 +773,7 @@ public class ConnectionManager extends LoopingThread protected ConMgrStats _stats; /** A runnable to execute when the connection manager thread exits. */ - protected Runnable _onExit; + protected volatile Runnable _onExit; /** Used to create an overflow queue on the first partial write. */ protected PartialWriteHandler _oflowHandler = new PartialWriteHandler() {