Package net.sf.colossus.webclient
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 java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static WebClient
private static final Logger
private final Options
To exchange data between us and the GetPlayersWeb dialog when game is started locallyprivate final IStartHandler
private final String
private final WebClient
private final WhatNextManager
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Fields inherited from interface net.sf.colossus.server.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 TypeMethodDescriptionvoid
void
void
gameStartupFailed
(String reason) int
static WebClient
if a Game Server game was started locally on players computer, then GameServerSide queries the starting web client from here.private WebClient
void
boolean
isActive()
boolean
void
void
run()
void
(package private) void
runGetPlayersDialogAndWait
(Options presetOptions, WhatNextManager whatNextManager) void
void
static void
sleepFor
(long millis) void
boolean
boolean
waitUntilGameStartedSuccessfully
(int timeout) boolean
waitUntilReadyToAcceptClients
(int timeout) Waits until socket is up, i.e.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, 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, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.colossus.webcommon.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
public void 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:
getHostingHost
in interfaceIGameRunner
-
getHostingPort
public int getHostingPort()- Specified by:
getHostingPort
in interfaceIGameRunner
-
makeRunningGame
public boolean makeRunningGame()- Specified by:
makeRunningGame
in interfaceIGameRunner
-
tryToStart
public boolean tryToStart()- Specified by:
tryToStart
in interfaceIGameRunner
-
setServerNull
public void setServerNull() -
waitUntilGameStartedSuccessfully
public boolean waitUntilGameStartedSuccessfully(int timeout) - Specified by:
waitUntilGameStartedSuccessfully
in interfaceIGameRunner
-
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 interfaceIGameRunner
-
isActive
public boolean isActive()- Specified by:
isActive
in interfaceINotifyWebServer
-
readyToAcceptClients
public void readyToAcceptClients()- Specified by:
readyToAcceptClients
in interfaceINotifyWebServer
-
gotClient
- Specified by:
gotClient
in interfaceINotifyWebServer
-
allClientsConnected
public void allClientsConnected()- Specified by:
allClientsConnected
in interfaceINotifyWebServer
-
gameStartupCompleted
public void gameStartupCompleted()- Specified by:
gameStartupCompleted
in interfaceINotifyWebServer
-
gameStartupFailed
- Specified by:
gameStartupFailed
in interfaceINotifyWebServer
-
serverStoppedRunning
public void serverStoppedRunning()- Specified by:
serverStoppedRunning
in interfaceINotifyWebServer
-