Class RunGameInSameJVM
java.lang.Object
java.lang.Thread
net.sf.colossus.webclient.RunGameInSameJVM
- All Implemented Interfaces:
Runnable, INotifyWebServer, IGameRunner
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static WebClientprivate static final Loggerprivate final OptionsTo exchange data between us and the GetPlayersWeb dialog when game is started locallyprivate final IStartHandlerprivate final Stringprivate final WebClientprivate final WhatNextManagerFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYFields inherited from interface INotifyWebServer
ALL_CLIENTS_CONNECTED, GAME_STARTUP_COMPLETED, GAME_STARTUP_FAILED -
Constructor Summary
ConstructorsConstructorDescriptionRunGameInSameJVM(GameInfo gi, WhatNextManager whatNextMgr, String username, WebClient webClient) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidgameStartupFailed(String reason) intstatic WebClientif a Game Server game was started locally on players computer, then GameServerSide queries the starting web client from here.private WebClientvoidbooleanisActive()booleanvoidvoidrun()void(package private) voidrunGetPlayersDialogAndWait(Options presetOptions, WhatNextManager whatNextManager) voidvoidstatic voidsleepFor(long millis) voidbooleanbooleanwaitUntilGameStartedSuccessfully(int timeout) booleanwaitUntilReadyToAcceptClients(int timeout) Waits until socket is up, i.e.Methods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yieldMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IGameRunner
start
-
Field Details
-
LOGGER
-
presetOptions
To exchange data between us and the GetPlayersWeb dialog when game is started locally -
webClient
-
whatNextManager
-
initiatingWebClient
-
username
-
startHandler
-
-
Constructor Details
-
RunGameInSameJVM
public RunGameInSameJVM(GameInfo gi, WhatNextManager whatNextMgr, String username, WebClient webClient)
-
-
Method Details
-
run
-
runGameInSameJVM
public void runGameInSameJVM() -
runGetPlayersDialogAndWait
-
tellServerToInformOtherPlayers
public void tellServerToInformOtherPlayers() -
sleepFor
public static void sleepFor(long millis) -
getWebClient
-
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
-
getHostingHost
- Specified by:
getHostingHostin interfaceIGameRunner
-
getHostingPort
public int getHostingPort()- Specified by:
getHostingPortin interfaceIGameRunner
-
makeRunningGame
public boolean makeRunningGame()- Specified by:
makeRunningGamein interfaceIGameRunner
-
tryToStart
public boolean tryToStart()- Specified by:
tryToStartin interfaceIGameRunner
-
setServerNull
public void setServerNull() -
waitUntilGameStartedSuccessfully
public boolean waitUntilGameStartedSuccessfully(int timeout) - Specified by:
waitUntilGameStartedSuccessfullyin interfaceIGameRunner
-
waitUntilReadyToAcceptClients
public boolean waitUntilReadyToAcceptClients(int timeout) Description copied from interface:IGameRunnerWaits until socket is up, i.e. game is ready to accept clients.- Specified by:
waitUntilReadyToAcceptClientsin interfaceIGameRunner
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceINotifyWebServer
-
readyToAcceptClients
public void readyToAcceptClients()- Specified by:
readyToAcceptClientsin interfaceINotifyWebServer
-
gotClient
- Specified by:
gotClientin interfaceINotifyWebServer
-
allClientsConnected
public void allClientsConnected()- Specified by:
allClientsConnectedin interfaceINotifyWebServer
-
gameStartupCompleted
public void gameStartupCompleted()- Specified by:
gameStartupCompletedin interfaceINotifyWebServer
-
gameStartupFailed
- Specified by:
gameStartupFailedin interfaceINotifyWebServer
-
serverStoppedRunning
public void serverStoppedRunning()- Specified by:
serverStoppedRunningin interfaceINotifyWebServer
-