org.starhope.appius.net
Class CaesarServer

java.lang.Object
  extended by java.lang.Thread
      extended by org.starhope.appius.net.NetIOThread
          extended by org.starhope.appius.net.CaesarServer
All Implemented Interfaces:
Comparable<Thread>, Runnable, Thread.UncaughtExceptionHandler, NetIOHandlerPeer, ServerProcessor, AcceptsMetronomeTicks, HasName, CanProcessCommands

public class CaesarServer
extends NetIOThread
implements ServerProcessor

Author:
brpocock@star-hope.org

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class org.starhope.appius.net.NetIOThread
debug, dialect, in, isDone, language, letsPlayWithFlash, out, parallelMode, socket, state
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CaesarServer(Socket sock)
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
protected  String processInput_Infinity(String theInput)
          Process input received using the JSON-based Infinity mode
protected  void sendRawMessageLater(String reply)
          Send a message to the user in future
 void sendResponse(org.json.JSONObject result)
          Send a response as a future (deferred remote) datagram without a room specified
 void setBusyState(boolean b)
           
 void setLastInputTime(long thatTime)
           
protected  String tattlePrefix()
          WRITEME: Document this method brpocock@star-hope.org
 void tick(long currentTime, long deltaTime)
          This method is called periodically from the metronome thread.
 void uncaughtException(Thread t, Throwable e)
           
 
Methods inherited from class org.starhope.appius.net.NetIOThread
checkInputStream, compareTo, doProcessing, dropSocket_socketCore, dropSocketConnection, equals, equals, getLanguage_dialect, getSocket, getVerboseBugReplies, hashCode, isDebug, isParallelMode, processInput, sendError_RAW, sendRawMessageNow, setDebug, setLanguage, setVerboseBugReplies, superVerbose, tattle, tattle, toInfinityAndBeyond
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.starhope.appius.net.ServerProcessor
start
 
Methods inherited from interface org.starhope.appius.util.HasName
getName
 
Methods inherited from interface org.starhope.util.types.CanProcessCommands
getName
 

Constructor Detail

CaesarServer

public CaesarServer(Socket sock)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
sock - the socket connected to the other endpoint
Method Detail

processInput_Infinity

protected String processInput_Infinity(String theInput)
Description copied from class: NetIOThread
Process input received using the JSON-based Infinity mode

Specified by:
processInput_Infinity in class NetIOThread
Parameters:
theInput - the input string identified as being Infinity-mode data
Returns:
a response for the other party in the communication
See Also:
NetIOThread.processInput_Infinity(java.lang.String)

sendRawMessageLater

protected void sendRawMessageLater(String reply)
                            throws UserDeadException
Description copied from class: NetIOThread
Send a message to the user in future

Specified by:
sendRawMessageLater in class NetIOThread
Parameters:
reply - The message to be sent in future
Throws:
UserDeadException - if the user is already gone
See Also:
NetIOThread.sendRawMessageLater(java.lang.String)

sendResponse

public void sendResponse(org.json.JSONObject result)
                  throws UserDeadException
Description copied from class: NetIOThread
Send a response as a future (deferred remote) datagram without a room specified

Specified by:
sendResponse in interface CanProcessCommands
Specified by:
sendResponse in class NetIOThread
Parameters:
result - a JSON-encoded response
Throws:
UserDeadException - if the user disconnects
See Also:
NetIOThread.sendResponse(org.json.JSONObject)

setBusyState

public void setBusyState(boolean b)
Specified by:
setBusyState in interface CanProcessCommands
Parameters:
b - whether the thread or processor is “busy”
See Also:
CanProcessCommands.setBusyState(boolean)

setLastInputTime

public void setLastInputTime(long thatTime)
Specified by:
setLastInputTime in interface CanProcessCommands
Parameters:
thatTime - WRITEME
See Also:
CanProcessCommands.setLastInputTime(long)

tattlePrefix

protected String tattlePrefix()
Description copied from class: NetIOThread
WRITEME: Document this method brpocock@star-hope.org

Specified by:
tattlePrefix in class NetIOThread
Returns:
WRITEME
See Also:
NetIOThread.tattlePrefix()

tick

public void tick(long currentTime,
                 long deltaTime)
          throws UserDeadException
Description copied from interface: AcceptsMetronomeTicks
This method is called periodically from the metronome thread. To save computation, it receives both the current time since epoch in milliseconds at the start of the global tick propagation, and the delta time since the previous metronome tick.

Specified by:
tick in interface AcceptsMetronomeTicks
Parameters:
currentTime - Time since epoch at the start of the global metronome propagation, as per System.currentTimeMillis()
deltaTime - Delta-time in milliseconds since the prior global metronome tick
Throws:
UserDeadException - if a user has died during this tick
See Also:
AcceptsMetronomeTicks.tick(long, long)

uncaughtException

public void uncaughtException(Thread t,
                              Throwable e)
Specified by:
uncaughtException in interface Thread.UncaughtExceptionHandler
See Also:
Thread.UncaughtExceptionHandler.uncaughtException(java.lang.Thread, java.lang.Throwable)