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
This commit is contained in:
@@ -119,7 +119,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
* action may be specified and it may be cleared by calling this
|
* action may be specified and it may be cleared by calling this
|
||||||
* method with null.
|
* method with null.
|
||||||
*/
|
*/
|
||||||
public synchronized void setShutdownAction (Runnable onExit)
|
public void setShutdownAction (Runnable onExit)
|
||||||
{
|
{
|
||||||
_onExit = onExit;
|
_onExit = onExit;
|
||||||
}
|
}
|
||||||
@@ -546,10 +546,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected void didShutdown ()
|
protected void didShutdown ()
|
||||||
{
|
{
|
||||||
Runnable onExit = null;
|
Runnable onExit = _onExit;
|
||||||
synchronized (this) {
|
|
||||||
onExit = _onExit;
|
|
||||||
}
|
|
||||||
if (onExit != null) {
|
if (onExit != null) {
|
||||||
Log.info("Connection Manager thread exited (running onExit).");
|
Log.info("Connection Manager thread exited (running onExit).");
|
||||||
onExit.run();
|
onExit.run();
|
||||||
@@ -776,7 +773,7 @@ public class ConnectionManager extends LoopingThread
|
|||||||
protected ConMgrStats _stats;
|
protected ConMgrStats _stats;
|
||||||
|
|
||||||
/** A runnable to execute when the connection manager thread exits. */
|
/** 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. */
|
/** Used to create an overflow queue on the first partial write. */
|
||||||
protected PartialWriteHandler _oflowHandler = new PartialWriteHandler() {
|
protected PartialWriteHandler _oflowHandler = new PartialWriteHandler() {
|
||||||
|
|||||||
Reference in New Issue
Block a user