public class RunGameInSameJVM extends java.lang.Thread implements IGameRunner, INotifyWebServer
| Modifier and Type | Field and Description |
|---|---|
private static WebClient |
initiatingWebClient |
private static java.util.logging.Logger |
LOGGER |
private Options |
presetOptions
To exchange data between us and the GetPlayersWeb dialog
when game is started locally
|
private IStartHandler |
startHandler |
private java.lang.String |
username |
private WebClient |
webClient |
private WhatNextManager |
whatNextManager |
ALL_CLIENTS_CONNECTED, GAME_STARTUP_COMPLETED, GAME_STARTUP_FAILED| Constructor and Description |
|---|
RunGameInSameJVM(GameInfo gi,
WhatNextManager whatNextMgr,
java.lang.String username,
WebClient webClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
allClientsConnected() |
void |
gameStartupCompleted() |
void |
gameStartupFailed(java.lang.String reason) |
java.lang.String |
getHostingHost() |
java.lang.String |
getHostingPlayerName() |
int |
getHostingPort() |
static WebClient |
getInitiatingWebClient()
if a Game Server game was started locally on players computer,
then GameServerSide queries the starting web client from here.
|
private WebClient |
getWebClient() |
void |
gotClient(java.lang.String playerName,
boolean remote) |
boolean |
isActive() |
boolean |
makeRunningGame() |
void |
readyToAcceptClients() |
void |
run() |
void |
runGameInSameJVM() |
(package private) void |
runGetPlayersDialogAndWait(Options presetOptions,
WhatNextManager whatNextManager) |
void |
serverStoppedRunning() |
void |
setServerNull() |
static void |
sleepFor(long millis) |
void |
tellServerToInformOtherPlayers() |
boolean |
tryToStart() |
boolean |
waitUntilGameStartedSuccessfully(int timeout) |
boolean |
waitUntilReadyToAcceptClients(int timeout)
Waits until socket is up, i.e.
|
activeCount, checkAccess, clone, 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, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitstartprivate static final java.util.logging.Logger LOGGER
private final Options presetOptions
private final WebClient webClient
private final WhatNextManager whatNextManager
private static WebClient initiatingWebClient
private final java.lang.String username
private final IStartHandler startHandler
public RunGameInSameJVM(GameInfo gi, WhatNextManager whatNextMgr, java.lang.String username, WebClient webClient)
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void runGameInSameJVM()
void runGetPlayersDialogAndWait(Options presetOptions, WhatNextManager whatNextManager)
public void tellServerToInformOtherPlayers()
public static void sleepFor(long millis)
private WebClient getWebClient()
public static WebClient getInitiatingWebClient()
public java.lang.String getHostingPlayerName()
public java.lang.String getHostingHost()
getHostingHost in interface IGameRunnerpublic int getHostingPort()
getHostingPort in interface IGameRunnerpublic boolean makeRunningGame()
makeRunningGame in interface IGameRunnerpublic boolean tryToStart()
tryToStart in interface IGameRunnerpublic void setServerNull()
public boolean waitUntilGameStartedSuccessfully(int timeout)
waitUntilGameStartedSuccessfully in interface IGameRunnerpublic boolean waitUntilReadyToAcceptClients(int timeout)
IGameRunnerwaitUntilReadyToAcceptClients in interface IGameRunnerpublic boolean isActive()
isActive in interface INotifyWebServerpublic void readyToAcceptClients()
readyToAcceptClients in interface INotifyWebServerpublic void gotClient(java.lang.String playerName,
boolean remote)
gotClient in interface INotifyWebServerpublic void allClientsConnected()
allClientsConnected in interface INotifyWebServerpublic void gameStartupCompleted()
gameStartupCompleted in interface INotifyWebServerpublic void gameStartupFailed(java.lang.String reason)
gameStartupFailed in interface INotifyWebServerpublic void serverStoppedRunning()
serverStoppedRunning in interface INotifyWebServer