net.sf.colossus.webclient
Class RunGameInSameJVM
java.lang.Object
java.lang.Thread
net.sf.colossus.webclient.RunGameInSameJVM
- All Implemented Interfaces:
- java.lang.Runnable, INotifyWebServer, IGameRunner
public class RunGameInSameJVM
- extends java.lang.Thread
- implements IGameRunner, INotifyWebServer
Nested classes/interfaces inherited from class java.lang.Thread |
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LOGGER
private static final java.util.logging.Logger LOGGER
presetOptions
private final Options presetOptions
- To exchange data between us and the GetPlayersWeb dialog
when game is started locally
webClient
private final WebClient webClient
whatNextManager
private final WhatNextManager whatNextManager
initiatingWebClient
private static WebClient initiatingWebClient
username
private final java.lang.String username
startHandler
private final IStartHandler startHandler
RunGameInSameJVM
public RunGameInSameJVM(GameInfo gi,
WhatNextManager whatNextMgr,
java.lang.String username,
WebClient webClient)
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
- Overrides:
run
in class java.lang.Thread
runGameInSameJVM
public void runGameInSameJVM()
runGetPlayersDialogAndWait
void runGetPlayersDialogAndWait(Options presetOptions,
WhatNextManager whatNextManager)
tellServerToInformOtherPlayers
public void tellServerToInformOtherPlayers()
sleepFor
public static void sleepFor(long millis)
getWebClient
private WebClient getWebClient()
getInitiatingWebClient
public static WebClient getInitiatingWebClient()
- if a Game Server game was started locally on players computer,
then GameServerSide queries the starting web client from here.
- Returns:
- The last WebClient that initiated a game start.
getHostingPlayerName
public java.lang.String getHostingPlayerName()
getHostingHost
public java.lang.String getHostingHost()
- Specified by:
getHostingHost
in interface IGameRunner
getHostingPort
public int getHostingPort()
- Specified by:
getHostingPort
in interface IGameRunner
makeRunningGame
public boolean makeRunningGame()
- Specified by:
makeRunningGame
in interface IGameRunner
tryToStart
public boolean tryToStart()
- Specified by:
tryToStart
in interface IGameRunner
setServerNull
public void setServerNull()
waitUntilGameStartedSuccessfully
public boolean waitUntilGameStartedSuccessfully(int timeout)
- Specified by:
waitUntilGameStartedSuccessfully
in interface IGameRunner
waitUntilReadyToAcceptClients
public boolean waitUntilReadyToAcceptClients(int timeout)
- Description copied from interface:
IGameRunner
- Waits until socket is up, i.e. game is ready to accept clients.
- Specified by:
waitUntilReadyToAcceptClients
in interface IGameRunner
isActive
public boolean isActive()
- Specified by:
isActive
in interface INotifyWebServer
readyToAcceptClients
public void readyToAcceptClients()
- Specified by:
readyToAcceptClients
in interface INotifyWebServer
gotClient
public void gotClient(java.lang.String playerName,
boolean remote)
- Specified by:
gotClient
in interface INotifyWebServer
allClientsConnected
public void allClientsConnected()
- Specified by:
allClientsConnected
in interface INotifyWebServer
gameStartupCompleted
public void gameStartupCompleted()
- Specified by:
gameStartupCompleted
in interface INotifyWebServer
serverStoppedRunning
public void serverStoppedRunning()
- Specified by:
serverStoppedRunning
in interface INotifyWebServer