Take our depends explicitly.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@643 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -31,14 +31,13 @@ import com.threerings.crowd.data.BodyObject;
|
|||||||
import com.threerings.parlor.tourney.data.Participant;
|
import com.threerings.parlor.tourney.data.Participant;
|
||||||
import com.threerings.parlor.tourney.data.TourneyConfig;
|
import com.threerings.parlor.tourney.data.TourneyConfig;
|
||||||
import com.threerings.parlor.tourney.data.TourneyCodes;
|
import com.threerings.parlor.tourney.data.TourneyCodes;
|
||||||
import com.threerings.parlor.tourney.data.TourneyMarshaller;
|
|
||||||
import com.threerings.parlor.tourney.data.TourneyObject;
|
import com.threerings.parlor.tourney.data.TourneyObject;
|
||||||
|
|
||||||
import com.threerings.presents.client.InvocationService;
|
import com.threerings.presents.client.InvocationService;
|
||||||
|
import com.threerings.presents.data.ClientObject;
|
||||||
|
import com.threerings.presents.dobj.RootDObjectManager;
|
||||||
import com.threerings.presents.server.InvocationException;
|
import com.threerings.presents.server.InvocationException;
|
||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
import com.threerings.presents.server.PresentsDObjectMgr;
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls a running tourney.
|
* Controls a running tourney.
|
||||||
@@ -46,17 +45,19 @@ import com.threerings.presents.data.ClientObject;
|
|||||||
public abstract class TourneyManager
|
public abstract class TourneyManager
|
||||||
implements TourneyProvider, TourneyCodes
|
implements TourneyProvider, TourneyCodes
|
||||||
{
|
{
|
||||||
public TourneyManager (TourneyConfig config, TourniesManager tmgr, Comparable key,
|
public TourneyManager (InvocationManager invmgr, RootDObjectManager omgr, TourneyConfig config,
|
||||||
InvocationService.ResultListener listener)
|
TourniesManager tmgr, Comparable key,
|
||||||
|
InvocationService.ResultListener listener)
|
||||||
{
|
{
|
||||||
|
_invmgr = invmgr;
|
||||||
|
_omgr = omgr;
|
||||||
_config = config;
|
_config = config;
|
||||||
_tmgr = tmgr;
|
_tmgr = tmgr;
|
||||||
_key = key;
|
_key = key;
|
||||||
|
|
||||||
// creare and configure our Tourney object
|
// creare and configure our Tourney object
|
||||||
_trobj = getOMgr().registerObject(new TourneyObject());
|
_trobj = _omgr.registerObject(new TourneyObject());
|
||||||
_trobj.setTourneyService((TourneyMarshaller)getInvMgr().registerDispatcher(
|
_trobj.setTourneyService(_invmgr.registerDispatcher(new TourneyDispatcher(this)));
|
||||||
new TourneyDispatcher(this)));
|
|
||||||
|
|
||||||
_trobj.config = config;
|
_trobj.config = config;
|
||||||
|
|
||||||
@@ -255,28 +256,18 @@ public abstract class TourneyManager
|
|||||||
|
|
||||||
// release the tourney provider
|
// release the tourney provider
|
||||||
if (_trobj.tourneyService != null) {
|
if (_trobj.tourneyService != null) {
|
||||||
getInvMgr().clearDispatcher(_trobj.tourneyService);
|
_invmgr.clearDispatcher(_trobj.tourneyService);
|
||||||
_trobj.tourneyService = null;
|
_trobj.tourneyService = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy the object in a couple of minutes
|
// destroy the object in a couple of minutes
|
||||||
new Interval(getOMgr()) {
|
new Interval(_omgr) {
|
||||||
public void expired () {
|
public void expired () {
|
||||||
getOMgr().destroyObject(_trobj.getOid());
|
_omgr.destroyObject(_trobj.getOid());
|
||||||
}
|
}
|
||||||
}.schedule(MINUTE * 2);
|
}.schedule(MINUTE * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a reference to our distributed object manager.
|
|
||||||
*/
|
|
||||||
protected abstract PresentsDObjectMgr getOMgr ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a reference to our invocation manager.
|
|
||||||
*/
|
|
||||||
protected abstract InvocationManager getInvMgr ();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the BodyObject for a username.
|
* Looks up the BodyObject for a username.
|
||||||
*/
|
*/
|
||||||
@@ -288,8 +279,11 @@ public abstract class TourneyManager
|
|||||||
protected abstract void joinTourney (BodyObject body)
|
protected abstract void joinTourney (BodyObject body)
|
||||||
throws InvocationException;
|
throws InvocationException;
|
||||||
|
|
||||||
/** One minute in milliseconds. */
|
/** Used to register and clear invocation services. */
|
||||||
protected static long MINUTE = 60 * 1000L;
|
protected InvocationManager _invmgr;
|
||||||
|
|
||||||
|
/** Provides distributed object services. */
|
||||||
|
protected RootDObjectManager _omgr;
|
||||||
|
|
||||||
/** Our touney configuration. */
|
/** Our touney configuration. */
|
||||||
protected TourneyConfig _config;
|
protected TourneyConfig _config;
|
||||||
@@ -305,4 +299,7 @@ public abstract class TourneyManager
|
|||||||
|
|
||||||
/** The key this tourney is recorded under. */
|
/** The key this tourney is recorded under. */
|
||||||
protected Comparable _key;
|
protected Comparable _key;
|
||||||
|
|
||||||
|
/** One minute in milliseconds. */
|
||||||
|
protected static long MINUTE = 60 * 1000L;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user