Let's make the Lifecycle a bit more abstract and decouple it from all the
server business. I'd move the whole kit and kaboodle to samskivert but that would mean moving the DependencyGraph as well... git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5804 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -35,6 +35,7 @@ import com.samskivert.util.ArrayIntSet;
|
||||
import com.samskivert.util.IntSet;
|
||||
import com.samskivert.util.Interval;
|
||||
|
||||
import com.threerings.util.Lifecycle;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.annotation.AnyThread;
|
||||
@@ -43,7 +44,6 @@ import com.threerings.presents.peer.data.ClientInfo;
|
||||
import com.threerings.presents.peer.data.NodeObject;
|
||||
import com.threerings.presents.peer.server.PeerManager;
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.LifecycleManager;
|
||||
import com.threerings.presents.server.PresentsDObjectMgr;
|
||||
|
||||
import com.threerings.crowd.chat.data.ChatChannel;
|
||||
@@ -62,7 +62,7 @@ import static com.threerings.crowd.Log.log;
|
||||
*/
|
||||
@Singleton
|
||||
public abstract class ChatChannelManager
|
||||
implements ChannelSpeakProvider, LifecycleManager.ShutdownComponent
|
||||
implements ChannelSpeakProvider, Lifecycle.ShutdownComponent
|
||||
{
|
||||
/**
|
||||
* When a body becomes a member of a channel, this method should be called so that any server
|
||||
@@ -114,7 +114,7 @@ public abstract class ChatChannelManager
|
||||
});
|
||||
}
|
||||
|
||||
// from interface LifecycleManager.Shutdowner
|
||||
// from interface Lifecycle.Shutdowner
|
||||
public void shutdown ()
|
||||
{
|
||||
// stop our channel closer; always be closing... except now
|
||||
@@ -126,10 +126,10 @@ public abstract class ChatChannelManager
|
||||
* Creates our singleton manager and registers our invocation service.
|
||||
*/
|
||||
@Inject protected ChatChannelManager (PresentsDObjectMgr omgr, InvocationManager invmgr,
|
||||
LifecycleManager lifemgr)
|
||||
Lifecycle cycle)
|
||||
{
|
||||
invmgr.registerDispatcher(new ChannelSpeakDispatcher(this), CrowdCodes.CROWD_GROUP);
|
||||
lifemgr.addComponent(this);
|
||||
cycle.addComponent(this);
|
||||
|
||||
// create and start our idle channel closer (always be closing)
|
||||
_closer = new Interval(omgr) {
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.threerings.crowd.peer.server;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import com.threerings.util.Lifecycle;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
@@ -32,7 +33,6 @@ import com.threerings.presents.peer.server.PeerManager;
|
||||
import com.threerings.presents.peer.server.PeerNode;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.LifecycleManager;
|
||||
import com.threerings.presents.server.PresentsSession;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatService;
|
||||
@@ -51,9 +51,9 @@ public abstract class CrowdPeerManager extends PeerManager
|
||||
/**
|
||||
* Creates an uninitialized peer manager.
|
||||
*/
|
||||
@Inject public CrowdPeerManager (LifecycleManager lifeMgr)
|
||||
@Inject public CrowdPeerManager (Lifecycle cycle)
|
||||
{
|
||||
super(lifeMgr);
|
||||
super(cycle);
|
||||
}
|
||||
|
||||
// from interface CrowdPeerProvider
|
||||
|
||||
@@ -30,11 +30,11 @@ import com.google.inject.Singleton;
|
||||
|
||||
import com.samskivert.util.IntMap;
|
||||
import com.samskivert.util.IntMaps;
|
||||
import com.threerings.util.Lifecycle;
|
||||
|
||||
import com.threerings.presents.dobj.RootDObjectManager;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.LifecycleManager;
|
||||
|
||||
import com.threerings.crowd.data.PlaceConfig;
|
||||
import com.threerings.crowd.data.PlaceObject;
|
||||
@@ -48,7 +48,7 @@ import static com.threerings.crowd.Log.log;
|
||||
*/
|
||||
@Singleton
|
||||
public class PlaceRegistry
|
||||
implements LifecycleManager.ShutdownComponent
|
||||
implements Lifecycle.ShutdownComponent
|
||||
{
|
||||
/** Used in conjunction with {@link PlaceRegistry#createPlace(PlaceConfig,PreStartupHook)}. */
|
||||
public static interface PreStartupHook
|
||||
@@ -60,9 +60,9 @@ public class PlaceRegistry
|
||||
* Creates and initializes the place registry. This is called by the server during its
|
||||
* initialization phase.
|
||||
*/
|
||||
@Inject public PlaceRegistry (LifecycleManager lifemgr)
|
||||
@Inject public PlaceRegistry (Lifecycle cycle)
|
||||
{
|
||||
lifemgr.addComponent(this);
|
||||
cycle.addComponent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ public class PlaceRegistry
|
||||
return _pmgrs.values().iterator();
|
||||
}
|
||||
|
||||
// from interface LifecycleManager.ShutdownComponent
|
||||
// from interface Lifecycle.ShutdownComponent
|
||||
public void shutdown ()
|
||||
{
|
||||
// shut down all active places
|
||||
|
||||
Reference in New Issue
Block a user