Modify the dobjmgr and invoker such that they process the rest of their
queue and then shutdown. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2365 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
@@ -223,6 +223,12 @@ public class PresentsDObjectMgr
|
|||||||
*/
|
*/
|
||||||
protected void processEvent (DEvent event)
|
protected void processEvent (DEvent event)
|
||||||
{
|
{
|
||||||
|
// handle graceful shutdown
|
||||||
|
if (event instanceof ShutdownEvent) {
|
||||||
|
_running = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// look up the target object
|
// look up the target object
|
||||||
DObject target = (DObject)_objects.get(event.getTargetOid());
|
DObject target = (DObject)_objects.get(event.getTargetOid());
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
@@ -278,8 +284,6 @@ public class PresentsDObjectMgr
|
|||||||
*/
|
*/
|
||||||
public void shutdown ()
|
public void shutdown ()
|
||||||
{
|
{
|
||||||
_running = false;
|
|
||||||
|
|
||||||
// stick a bogus object on the event queue to ensure that the mgr
|
// stick a bogus object on the event queue to ensure that the mgr
|
||||||
// wakes up and smells the coffee
|
// wakes up and smells the coffee
|
||||||
_evqueue.append(new ShutdownEvent());
|
_evqueue.append(new ShutdownEvent());
|
||||||
|
|||||||
@@ -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;
|
package com.threerings.presents.util;
|
||||||
|
|
||||||
@@ -120,17 +120,20 @@ public class Invoker extends LoopingThread
|
|||||||
Log.warning("Invocation unit failed [unit=" + unit + "].");
|
Log.warning("Invocation unit failed [unit=" + unit + "].");
|
||||||
Log.logStackTrace(e);
|
Log.logStackTrace(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if it's not a runnable, it was probably just an object posted
|
} else {
|
||||||
// to our queue to wake us up in time to die, so we just ignore it
|
// 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
|
// documentation inherited
|
||||||
protected void kick ()
|
public void shutdown ()
|
||||||
{
|
{
|
||||||
// add a non-runnable to the queue which will be ignored by the
|
// we do some custom shutdown business: add a non-runnable to the
|
||||||
// invoker but will cause it to wake up and go away
|
// queue which, when the invoker gets to it, will cause it to shut
|
||||||
|
// itself down
|
||||||
_queue.append(new Integer(0));
|
_queue.append(new Integer(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user