Out with ShutdownManager, in with LifecycleManager which handles both
initialization and shutdown. This will obviate the need for a lot of manual wiring up. ShutdownManager still works and passes through to LifecycleManager, but switching to the new deal is encouraged. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5802 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -43,8 +43,8 @@ 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.presents.server.ShutdownManager;
|
||||
|
||||
import com.threerings.crowd.chat.data.ChatChannel;
|
||||
import com.threerings.crowd.chat.data.ChatCodes;
|
||||
@@ -62,7 +62,7 @@ import static com.threerings.crowd.Log.log;
|
||||
*/
|
||||
@Singleton
|
||||
public abstract class ChatChannelManager
|
||||
implements ChannelSpeakProvider, ShutdownManager.Shutdowner
|
||||
implements ChannelSpeakProvider, LifecycleManager.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 ShutdownManager.Shutdowner
|
||||
// from interface LifecycleManager.Shutdowner
|
||||
public void shutdown ()
|
||||
{
|
||||
// stop our channel closer; always be closing... except now
|
||||
@@ -126,15 +126,14 @@ public abstract class ChatChannelManager
|
||||
* Creates our singleton manager and registers our invocation service.
|
||||
*/
|
||||
@Inject protected ChatChannelManager (PresentsDObjectMgr omgr, InvocationManager invmgr,
|
||||
ShutdownManager shutmgr)
|
||||
LifecycleManager lifemgr)
|
||||
{
|
||||
invmgr.registerDispatcher(new ChannelSpeakDispatcher(this), CrowdCodes.CROWD_GROUP);
|
||||
shutmgr.registerShutdowner(this);
|
||||
lifemgr.addComponent(this);
|
||||
|
||||
// create and start our idle channel closer (always be closing)
|
||||
_closer = new Interval(omgr) {
|
||||
@Override
|
||||
public void expired () {
|
||||
@Override public void expired () {
|
||||
closeIdleChannels();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,8 +32,8 @@ 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.presents.server.ShutdownManager;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatService;
|
||||
import com.threerings.crowd.chat.data.UserMessage;
|
||||
@@ -51,9 +51,9 @@ public abstract class CrowdPeerManager extends PeerManager
|
||||
/**
|
||||
* Creates an uninitialized peer manager.
|
||||
*/
|
||||
@Inject public CrowdPeerManager (ShutdownManager shutmgr)
|
||||
@Inject public CrowdPeerManager (LifecycleManager lifeMgr)
|
||||
{
|
||||
super(shutmgr);
|
||||
super(lifeMgr);
|
||||
}
|
||||
|
||||
// from interface CrowdPeerProvider
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.samskivert.util.IntMaps;
|
||||
import com.threerings.presents.dobj.RootDObjectManager;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.ShutdownManager;
|
||||
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 ShutdownManager.Shutdowner
|
||||
implements LifecycleManager.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 (ShutdownManager shutmgr)
|
||||
@Inject public PlaceRegistry (LifecycleManager lifemgr)
|
||||
{
|
||||
shutmgr.registerShutdowner(this);
|
||||
lifemgr.addComponent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ public class PlaceRegistry
|
||||
return _pmgrs.values().iterator();
|
||||
}
|
||||
|
||||
// from interface ShutdownManager.Shutdowner
|
||||
// from interface LifecycleManager.ShutdownComponent
|
||||
public void shutdown ()
|
||||
{
|
||||
// shut down all active places
|
||||
|
||||
Reference in New Issue
Block a user