Allow a little more info in deciding whether to declare the place empty.
Also, while I was in there, added some safety so we don't lose track of shutdownIntervals and let them run amuck. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4295 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -452,7 +452,7 @@ public class PlaceManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clear out their canonical (local) occupant info record
|
// clear out their canonical (local) occupant info record
|
||||||
_occInfo.remove(bodyOid);
|
OccupantInfo leaver = _occInfo.remove(bodyOid);
|
||||||
|
|
||||||
// let our delegates know what's up
|
// let our delegates know what's up
|
||||||
applyToDelegates(new DelegateOp() {
|
applyToDelegates(new DelegateOp() {
|
||||||
@@ -462,7 +462,7 @@ public class PlaceManager
|
|||||||
});
|
});
|
||||||
|
|
||||||
// if that leaves us with zero occupants, maybe do something
|
// if that leaves us with zero occupants, maybe do something
|
||||||
if (shouldDeclareEmpty()) {
|
if (shouldDeclareEmpty(leaver)) {
|
||||||
placeBecameEmpty();
|
placeBecameEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,7 +471,7 @@ public class PlaceManager
|
|||||||
* Returns whether the location should be marked as empty and potentially
|
* Returns whether the location should be marked as empty and potentially
|
||||||
* shutdown.
|
* shutdown.
|
||||||
*/
|
*/
|
||||||
protected boolean shouldDeclareEmpty ()
|
protected boolean shouldDeclareEmpty (OccupantInfo leaver)
|
||||||
{
|
{
|
||||||
return (_plobj.occupants.size() == 0);
|
return (_plobj.occupants.size() == 0);
|
||||||
}
|
}
|
||||||
@@ -514,9 +514,9 @@ public class PlaceManager
|
|||||||
*/
|
*/
|
||||||
protected void checkShutdownInterval ()
|
protected void checkShutdownInterval ()
|
||||||
{
|
{
|
||||||
// queue up a shutdown interval
|
// queue up a shutdown interval, unless we've already got one.
|
||||||
long idlePeriod = idleUnloadPeriod();
|
long idlePeriod = idleUnloadPeriod();
|
||||||
if (idlePeriod > 0L) {
|
if (idlePeriod > 0L && _shutdownInterval == null) {
|
||||||
_shutdownInterval = new Interval((PresentsDObjectMgr)_omgr) {
|
_shutdownInterval = new Interval((PresentsDObjectMgr)_omgr) {
|
||||||
public void expired () {
|
public void expired () {
|
||||||
Log.debug("Unloading idle place '" + where () + "'.");
|
Log.debug("Unloading idle place '" + where () + "'.");
|
||||||
|
|||||||
Reference in New Issue
Block a user