Package net.sf.colossus.webserver
Class GameManager
- java.lang.Object
-
- net.sf.colossus.webserver.GameManager
-
- All Implemented Interfaces:
java.rmi.Remote
,IGameManager
public class GameManager extends java.lang.Object implements IGameManager
This "manager" is accessible via RMI (served by the ColossusRegistry object) for the games started in own processes. Once a game comes up, it can register to here, telling it's game Id, and reporting anything that happens which is of interest to the server; for example, this could be things like player died etc. Additionally the server can communicate with the games, because it gets their game Id, and looks up the ManagedGame remote object for it. TODO: work just started (2011-04-24)- Author:
- Clemens Katzer
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,IManagedGame>
games
private static java.util.logging.Logger
LOGGER
static java.lang.String
OBJ_ID
private ColossusRegistry
r
private java.rmi.registry.Registry
registry
-
Constructor Summary
Constructors Constructor Description GameManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
doGetRegistry()
private static void
exitOnReturn(GameManager gm)
int
getGameCount()
private void
initRegistryIfNeeded()
void
listRegistryContents()
private IManagedGame
lookupGameByRegid(java.lang.String gameId)
static void
main(java.lang.String[] args)
This is only for testing purposes.void
registerGame(java.lang.String gameId)
private void
registerManager()
private static void
sleepFor(long millis)
void
tellEvent(java.lang.String description)
void
unregisterGame(java.lang.String gameId)
void
unregisterManager()
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
OBJ_ID
public static final java.lang.String OBJ_ID
- See Also:
- Constant Field Values
-
games
private final java.util.HashMap<java.lang.String,IManagedGame> games
-
r
private ColossusRegistry r
-
registry
private java.rmi.registry.Registry registry
-
-
Method Detail
-
initRegistryIfNeeded
private void initRegistryIfNeeded()
-
doGetRegistry
private void doGetRegistry()
-
listRegistryContents
public void listRegistryContents()
-
registerManager
private void registerManager()
-
unregisterManager
public void unregisterManager()
-
getGameCount
public int getGameCount()
-
tellEvent
public void tellEvent(java.lang.String description) throws java.rmi.RemoteException
- Specified by:
tellEvent
in interfaceIGameManager
- Throws:
java.rmi.RemoteException
-
registerGame
public void registerGame(java.lang.String gameId) throws java.rmi.RemoteException, java.rmi.NotBoundException
- Specified by:
registerGame
in interfaceIGameManager
- Throws:
java.rmi.RemoteException
java.rmi.NotBoundException
-
unregisterGame
public void unregisterGame(java.lang.String gameId) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
- Specified by:
unregisterGame
in interfaceIGameManager
- Throws:
java.rmi.AccessException
java.rmi.NotBoundException
java.rmi.RemoteException
-
lookupGameByRegid
private IManagedGame lookupGameByRegid(java.lang.String gameId) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
- Throws:
java.rmi.AccessException
java.rmi.NotBoundException
java.rmi.RemoteException
-
main
public static void main(java.lang.String[] args)
This is only for testing purposes. Normally the GameManager object is created by WebServer object.
-
sleepFor
private static void sleepFor(long millis)
-
exitOnReturn
private static void exitOnReturn(GameManager gm)
-
-