diff --git a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java index d9b6ad4f3..a261a63de 100644 --- a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java +++ b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java @@ -1,5 +1,5 @@ // -// $Id: PresentsDObjectMgr.java,v 1.29 2003/03/10 18:29:54 mdb Exp $ +// $Id: PresentsDObjectMgr.java,v 1.30 2003/03/31 04:11:24 mdb Exp $ package com.threerings.presents.server; @@ -223,6 +223,12 @@ public class PresentsDObjectMgr */ protected void processEvent (DEvent event) { + // handle graceful shutdown + if (event instanceof ShutdownEvent) { + _running = false; + return; + } + // look up the target object DObject target = (DObject)_objects.get(event.getTargetOid()); if (target == null) { @@ -278,8 +284,6 @@ public class PresentsDObjectMgr */ public void shutdown () { - _running = false; - // stick a bogus object on the event queue to ensure that the mgr // wakes up and smells the coffee _evqueue.append(new ShutdownEvent()); diff --git a/src/java/com/threerings/presents/util/Invoker.java b/src/java/com/threerings/presents/util/Invoker.java index c4b8535ba..edbb3a6a8 100644 --- a/src/java/com/threerings/presents/util/Invoker.java +++ b/src/java/com/threerings/presents/util/Invoker.java @@ -1,5 +1,5 @@ // -// $Id: Invoker.java,v 1.5 2002/10/05 23:35:21 mdb Exp $ +// $Id: Invoker.java,v 1.6 2003/03/31 04:11:24 mdb Exp $ package com.threerings.presents.util; @@ -120,17 +120,20 @@ public class Invoker extends LoopingThread Log.warning("Invocation unit failed [unit=" + unit + "]."); Log.logStackTrace(e); } - } - // if it's not a runnable, it was probably just an object posted - // to our queue to wake us up in time to die, so we just ignore it + } else { + // if it's not a runnable, it was just an object posted to our + // queue to wake us up and tell us to go away + _running = false; + } } // documentation inherited - protected void kick () + public void shutdown () { - // add a non-runnable to the queue which will be ignored by the - // invoker but will cause it to wake up and go away + // we do some custom shutdown business: add a non-runnable to the + // queue which, when the invoker gets to it, will cause it to shut + // itself down _queue.append(new Integer(0)); }