Class ClientThread

java.lang.Object
java.lang.Thread
net.sf.colossus.client.ClientThread
All Implemented Interfaces:
Runnable

public class ClientThread extends Thread
This will be a thread that executes all the client side processing; additional to the actual SocketClientThread which did that earlier. SCT will only handle the reading from Socket and push incoming messages to a queue and return back to listening on the socket. This way, it should be able to read all data in time so that no data pile up, and reply to ping requests almost instantly. ClientThread gets most of messages to parse already via a queue. Should also sending use a queue, and/or, the sending methods be inside ClientThread, and SocketClientThread merely provide the sendToServer method (which could be implemented differently e.g. in a "send via queue, instead of via socket", for local clients)?
Author:
Clemens Katzer
  • Field Details

  • Constructor Details

    • ClientThread

      public ClientThread(Client client)
  • Method Details

    • nextThreadNumber

      private static int nextThreadNumber()
    • getThreadNumber

      public int getThreadNumber()
    • enqueue

      public void enqueue(String method, List<String> args)
    • getQueueLen

      public int getQueueLen()
    • disposeQueue

      public void disposeQueue()
    • disposeClient

      public void disposeClient()
    • setClosedByServer

      public void setClosedByServer()
    • getNameMaybe

      public String getNameMaybe()
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • notifyUserIfGameIsPaused

      public void notifyUserIfGameIsPaused(String message)
    • notifyThatNotConnected

      public void notifyThatNotConnected()
    • appendToConnectionLog

      public void appendToConnectionLog(String s)
    • callMethod

      private void callMethod(String method, List<String> args)
    • resolveHex

      private MasterHex resolveHex(String label)
    • resolveBattleHex

      private BattleHex resolveBattleHex(String hexLabel)
    • resolveCreatureTypes

      private List<CreatureType> resolveCreatureTypes(String nameList)
    • resolveCreatureType

      private CreatureType resolveCreatureType(String creatureName)
    • resolveLegion

      private Legion resolveLegion(String markerId)
    • getNow

      public static long getNow()