net.sf.colossus.util
Class ViableEntityManager
java.lang.Object
net.sf.colossus.util.ViableEntityManager
public class ViableEntityManager
- extends java.lang.Object
Keeps track of "viable entities", i.e. parts of the program
for which it makes sense to have them living on their own.
Viable entities so far are :
- the game server part with it's subthreads,
- the user Client with MasterBoard (e.g. as remote client)
- the web server client
The reason is, earlier each of them may at some point do
System.exit(), even if one would have liked to keep one
other part open. (for example, 3 local players -- if one
was dead and you closed that MasterBoard, the whole application
did exit.
Now, each of those tells the ViableEntityManager "I'm done",
and if the last one says so, THEN the System.exit() is
actually executed. Or rather, nowadays, the main() thread
can go on, come up with a menu again or something.
- Author:
- Clemens Katzer
Field Summary |
private static boolean |
debug
|
private static java.util.logging.Logger |
LOGGER
|
private static java.lang.Object |
mutex
|
private static java.util.WeakHashMap<java.lang.Object,java.lang.String> |
viableEntities
|
private static int |
waiting
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOGGER
private static final java.util.logging.Logger LOGGER
debug
private static boolean debug
viableEntities
private static java.util.WeakHashMap<java.lang.Object,java.lang.String> viableEntities
waiting
private static int waiting
mutex
private static java.lang.Object mutex
ViableEntityManager
public ViableEntityManager()
register
public static void register(java.lang.Object viableEntity,
java.lang.String name)
unregister
public static void unregister(java.lang.Object viableEntity)
getWaitingCnt
public static int getWaitingCnt()
waitUntilAllGone
public static void waitUntilAllGone()