Have the client manager let the clients know that they are being shutdown.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2357 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ClientManager.java,v 1.29 2003/03/02 03:47:06 mdb Exp $
|
// $Id: ClientManager.java,v 1.30 2003/03/30 21:04:18 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import com.samskivert.util.IntervalManager;
|
import com.samskivert.util.IntervalManager;
|
||||||
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import com.threerings.presents.Log;
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
@@ -31,7 +32,8 @@ import com.threerings.presents.server.util.SafeInterval;
|
|||||||
* boot for application-defined reasons).
|
* boot for application-defined reasons).
|
||||||
*/
|
*/
|
||||||
public class ClientManager
|
public class ClientManager
|
||||||
implements ConnectionObserver, PresentsServer.Reporter
|
implements ConnectionObserver, PresentsServer.Reporter,
|
||||||
|
PresentsServer.Shutdowner
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Used by {@link #applyToClient}.
|
* Used by {@link #applyToClient}.
|
||||||
@@ -70,6 +72,22 @@ public class ClientManager
|
|||||||
PresentsServer.registerReporter(this);
|
PresentsServer.registerReporter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited from interface
|
||||||
|
public void shutdown ()
|
||||||
|
{
|
||||||
|
// inform all of our clients that they are being shut down
|
||||||
|
for (Iterator iter = _usermap.values().iterator(); iter.hasNext(); ) {
|
||||||
|
PresentsClient pc = (PresentsClient)iter.next();
|
||||||
|
try {
|
||||||
|
pc.shutdown();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.warning("Client choked in shutdonw() [client=" +
|
||||||
|
StringUtil.safeToString(pc) + "].");
|
||||||
|
Log.logStackTrace(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instructs the client manager to construct instances of this derived
|
* Instructs the client manager to construct instances of this derived
|
||||||
* class of {@link PresentsClient} to managed newly accepted client
|
* class of {@link PresentsClient} to managed newly accepted client
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: PresentsClient.java,v 1.52 2003/02/01 04:43:47 mdb Exp $
|
// $Id: PresentsClient.java,v 1.53 2003/03/30 21:04:18 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.presents.server;
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
@@ -383,6 +383,18 @@ public class PresentsClient
|
|||||||
_clobj = null;
|
_clobj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the server is shut down in the middle of a
|
||||||
|
* client session. In this circumstance, {@link #endSession} will
|
||||||
|
* <em>not</em> be called and so any persistent data that might
|
||||||
|
* normally be flushed at the end of a client's session should likely
|
||||||
|
* be flushed here.
|
||||||
|
*/
|
||||||
|
public void shutdown ()
|
||||||
|
{
|
||||||
|
// nothing to do by default
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a note that this client is subscribed to this object so that
|
* Makes a note that this client is subscribed to this object so that
|
||||||
* we can clean up after ourselves if and when the client goes
|
* we can clean up after ourselves if and when the client goes
|
||||||
|
|||||||
Reference in New Issue
Block a user