Class RunGameInSameJVM

java.lang.Object
java.lang.Thread
net.sf.colossus.webclient.RunGameInSameJVM
All Implemented Interfaces:
Runnable, INotifyWebServer, IGameRunner

public class RunGameInSameJVM extends Thread implements IGameRunner, INotifyWebServer
  • Field Details

    • LOGGER

      private static final 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 String username
    • startHandler

      private final IStartHandler startHandler
  • Constructor Details

  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class 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 String getHostingPlayerName()
    • getHostingHost

      public 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(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
    • gameStartupFailed

      public void gameStartupFailed(String reason)
      Specified by:
      gameStartupFailed in interface INotifyWebServer
    • serverStoppedRunning

      public void serverStoppedRunning()
      Specified by:
      serverStoppedRunning in interface INotifyWebServer