We can't rely on the connection manager not being shutdown to determine

whether or not we're already shutdown as it may have shutdown
unexpectedly.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3415 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-03-18 19:08:18 +00:00
parent 77f9d8836c
commit 9682983526
@@ -259,17 +259,21 @@ public class PresentsServer
*/ */
public void shutdown () public void shutdown ()
{ {
ObserverList downers = _downers;
if (downers == null) {
Log.warning("Refusing repeat shutdown request.");
return;
}
_downers = null;
// shut down the connection manager (this will cease all network // shut down the connection manager (this will cease all network
// activity but not actually close the connections) // activity but not actually close the connections)
if (conmgr.isRunning()) { if (conmgr.isRunning()) {
conmgr.shutdown(); conmgr.shutdown();
} else {
Log.warning("Refusing repeat shutdown request.");
return;
} }
// shut down all shutdown participants // shut down all shutdown participants
_downers.apply(new ObserverList.ObserverOp() { downers.apply(new ObserverList.ObserverOp() {
public boolean apply (Object observer) { public boolean apply (Object observer) {
((Shutdowner)observer).shutdown(); ((Shutdowner)observer).shutdown();
return true; return true;