Use PresentsDObjectManager.newInterval

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@862 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Charlie Groves
2009-07-21 00:11:57 +00:00
parent e07fd189b6
commit e31ce21c70
2 changed files with 11 additions and 25 deletions
@@ -783,13 +783,11 @@ public class GameManager extends PlaceManager
_gameconfig = (GameConfig)_config;
// start up our tick interval
_tickInterval = new Interval(_omgr) {
@Override
public void expired () {
_tickInterval = _omgr.newInterval(new Runnable() {
public void run () {
tick(System.currentTimeMillis());
}
};
_tickInterval.schedule(TICK_DELAY, true);
}).schedule(TICK_DELAY, true);
// configure our AIs
for (int ii = 0; ii < _gameconfig.ais.length; ii++) {
@@ -1115,13 +1113,11 @@ public class GameManager extends PlaceManager
protected void startAITicker ()
{
if (_aiTicker == null) {
_aiTicker = new Interval(_omgr) {
@Override
public void expired () {
_aiTicker = _omgr.newInterval(new Runnable() {
public void run () {
tickAIs();
}
};
_aiTicker.schedule(AI_TICK_DELAY, true);
}).schedule(AI_TICK_DELAY, true);
}
}
@@ -1272,6 +1268,7 @@ public class GameManager extends PlaceManager
protected void gameWasCancelled ()
{
// nothing to do by default
stopAITicker();
}
/**
@@ -30,7 +30,6 @@ import com.google.inject.Injector;
import com.google.inject.Singleton;
import com.samskivert.io.PersistenceException;
import com.samskivert.util.Interval;
import com.samskivert.util.Lifecycle;
import com.threerings.presents.client.InvocationService;
@@ -48,7 +47,7 @@ import static com.threerings.parlor.Log.log;
*/
@Singleton
public abstract class TourniesManager
implements TourniesProvider, Lifecycle.Component
implements TourniesProvider, Lifecycle.InitComponent
{
@Inject public TourniesManager (Lifecycle cycle)
{
@@ -60,18 +59,11 @@ public abstract class TourniesManager
{
loadTourneyConfigs();
_interval = new Interval(_omgr) {
@Override public void expired () {
_omgr.newInterval(new Runnable() {
public void run () {
updateTournies();
}
};
_interval.schedule(getIntervalDelay(), true);
}
// from interface Lifecycle.Component
public void shutdown ()
{
_interval.cancel();
}).schedule(getIntervalDelay(), true);
}
// from interface TourniesService
@@ -139,9 +131,6 @@ public abstract class TourniesManager
*/
protected abstract long getIntervalDelay ();
/** The interval which updates loaded tournies. */
protected Interval _interval;
/** Count to provide a unique key to tournies as they're created. */
protected int _tourneyCount;