Wait for everything to clear before starting the connection manager, and split out the code called when starting said manager so subclasses can override that
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5900 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -40,6 +40,7 @@ import com.threerings.presents.dobj.AccessController;
|
|||||||
import com.threerings.presents.dobj.DObject;
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.DObjectManager;
|
import com.threerings.presents.dobj.DObjectManager;
|
||||||
import com.threerings.presents.dobj.RootDObjectManager;
|
import com.threerings.presents.dobj.RootDObjectManager;
|
||||||
|
import com.threerings.presents.server.PresentsDObjectMgr.LongRunnable;
|
||||||
import com.threerings.presents.server.net.ConnectionManager;
|
import com.threerings.presents.server.net.ConnectionManager;
|
||||||
|
|
||||||
import com.threerings.crowd.server.PlaceManager;
|
import com.threerings.crowd.server.PlaceManager;
|
||||||
@@ -175,18 +176,32 @@ public class PresentsServer
|
|||||||
*/
|
*/
|
||||||
public void run ()
|
public void run ()
|
||||||
{
|
{
|
||||||
// post a unit that will start up the connection manager when everything else in the
|
// wait till everything in the dobjmgr queue and invokers are processed and then start the
|
||||||
// dobjmgr queue is processed
|
// connection manager
|
||||||
_omgr.postRunnable(new Runnable() {
|
((PresentsInvoker)_invoker).postRunnableWhenEmpty(new Runnable() {
|
||||||
public void run () {
|
public void run () {
|
||||||
// start up the connection manager
|
// Take as long as you like opening to the public
|
||||||
_conmgr.start();
|
_omgr.postRunnable(new LongRunnable() {
|
||||||
|
public void run () {
|
||||||
|
openToThePublic();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// invoke the dobjmgr event loop
|
// invoke the dobjmgr event loop
|
||||||
_omgr.run();
|
_omgr.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the server for connections after the event thread is running and all the invokers are
|
||||||
|
* clear after starting up.
|
||||||
|
*/
|
||||||
|
protected void openToThePublic ()
|
||||||
|
{
|
||||||
|
log.info("Opening the gates");
|
||||||
|
_conmgr.start();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues up a request to shutdown on the event thread. This method may be safely called from
|
* Queues up a request to shutdown on the event thread. This method may be safely called from
|
||||||
* any thread.
|
* any thread.
|
||||||
|
|||||||
Reference in New Issue
Block a user