Added RootDObjectManager.newInterval() for creating intervals that are

automatically canceled when the omgr is shutdown (they actually cancel
themselves if they fire after the omgr has been shutdown, which stock intervals
also do, but these guys do so quietly because we know they mean to work that
way).

Made use of that new method and the fluent schedule methods in various places.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5880 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-07-20 22:43:00 +00:00
parent 57b630727e
commit c0c68f98d3
8 changed files with 65 additions and 78 deletions
@@ -276,6 +276,20 @@ public class PresentsDObjectMgr
postEvent(new ObjectDestroyedEvent(oid));
}
// from interface RootDObjectManager
public Interval newInterval (final Runnable action)
{
return new Interval(this) {
public void expired () {
if (isRunning()) {
action.run();
} else {
cancel();
}
}
};
}
/**
* Returns the object in the object table with the specified oid or null if no object has that
* oid. Be sure only to call this function from the dobjmgr thread and not to do anything funny