|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.starhope.appius.net.NetIOThread
public abstract class NetIOThread
Networking I/O threads, for either client or server using the "Infinity Mode" protocol (or, to a limited extent, the surviving entrails of the SmartFaux mode)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected boolean |
debug
Boolean flag indicating whether the server is in debugging mode or not. |
protected String |
dialect
WRITEME: Document this brpocock@star-hope.org |
protected BufferedReader |
in
The buffered input stream from the user. |
protected boolean |
isDone
This indicates whether the thread has voluntarily decided to exit, e.g. |
protected String |
language
WRITEME: Document this brpocock@star-hope.org |
protected String |
letsPlayWithFlash
This is a crazy XML looking string that we have to pump out to make the Flash plug-in happy. |
protected PrintWriter |
out
The output stream connected to the pipe |
(package private) boolean |
parallelMode
WRITEME |
protected Socket |
socket
The socket connected to the other end of the communications |
protected int |
state
The state of the conversation that we are having with the other party |
private boolean |
verboseBugReplies
WRITEME: Document this brpocock@star-hope.org |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
NetIOThread()
WRITEME |
|
NetIOThread(String string)
Create a new NetIOThread with the given name |
Method Summary | |
---|---|
protected void |
checkInputStream()
Peek for input. |
int |
compareTo(Thread other)
Compare two threads |
protected String |
doProcessing(String theInput)
|
protected void |
dropSocket_socketCore()
The core code that actually disconnects the socket hard. |
protected void |
dropSocketConnection()
Drop the I/O socket for this user. |
boolean |
equals(NetIOThread other)
This is an overriding method. |
boolean |
equals(Object other)
This is an overriding method. |
String |
getLanguage_dialect()
WRITEME: Document this method brpocock@star-hope.org |
protected String |
getRemoteAddress()
|
protected Socket |
getSocket()
Get the socket connection to the pipe |
boolean |
getVerboseBugReplies()
|
int |
hashCode()
|
boolean |
isDebug()
Determine whether the server is in debugging mode |
boolean |
isParallelMode()
WRITEME: Document this method brpocock@star-hope.org |
protected abstract String |
processInput_Infinity(String theInput)
Process input received using the JSON-based Infinity mode |
String |
processInput(String theInput)
Process and dispatch input from the pipe. |
void |
sendError_RAW(String errorSource,
String message)
Send a raw error message back to the session as a JSON response |
protected abstract void |
sendRawMessageLater(String reply)
Send a message to the user in future |
protected void |
sendRawMessageNow(String reply)
Send a raw message packet to the local other party immediately |
abstract void |
sendResponse(org.json.JSONObject result)
Send a response as a future (deferred remote) datagram without a room specified |
void |
setDebug(boolean newDebug)
Set the server's debugging mode on (true) or off (false) |
void |
setLanguage(String newLanguage,
String newDialect)
WRITEME: Document this method brpocock@star-hope.org |
void |
setVerboseBugReplies(boolean really)
Send the client verbose breakdowns of bug reports |
protected void |
superVerbose(String string)
Deprecated. |
void |
tattle(String message)
tattle a non-urgent message |
void |
tattle(String tattle,
boolean urgent)
Print a log entry to STDERR with a great deal of identifiable detail |
protected abstract String |
tattlePrefix()
WRITEME: Document this method brpocock@star-hope.org |
protected void |
toInfinityAndBeyond()
engage Infinity-mode protocol |
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.util.AcceptsMetronomeTicks |
---|
tick |
Methods inherited from interface org.starhope.appius.util.HasName |
---|
getName |
Methods inherited from interface java.lang.Thread.UncaughtExceptionHandler |
---|
uncaughtException |
Methods inherited from interface org.starhope.util.types.CanProcessCommands |
---|
getName, setBusyState, setLastInputTime |
Field Detail |
---|
protected Socket socket
protected BufferedReader in
protected boolean debug
protected boolean isDone
protected String letsPlayWithFlash
protected int state
boolean parallelMode
protected String language
protected String dialect
protected PrintWriter out
private boolean verboseBugReplies
Constructor Detail |
---|
public NetIOThread()
public NetIOThread(String string)
string
- WRITEMEMethod Detail |
---|
protected void checkInputStream() throws UserDeadException
UserDeadException
- if the remote user has disconnectedpublic int compareTo(Thread other)
compareTo
in interface Comparable<Thread>
other
- another server threadComparable.compareTo(java.lang.Object)
protected String doProcessing(String theInput)
theInput
- to be processed
protected void dropSocket_socketCore()
protected void dropSocketConnection()
public boolean equals(NetIOThread other)
other
- the other thread against which to compare
Object.equals(java.lang.Object)
public boolean equals(Object other)
equals
in class Object
Object.equals(java.lang.Object)
public String getLanguage_dialect()
protected String getRemoteAddress()
protected Socket getSocket()
public boolean getVerboseBugReplies()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean isDebug()
public boolean isParallelMode()
public String processInput(String theInput)
theInput
- The input packet from the pipe
protected abstract String processInput_Infinity(String theInput)
theInput
- the input string identified as being
Infinity-mode data
public void sendError_RAW(String errorSource, String message)
sendError_RAW
in interface CanProcessCommands
errorSource
- The method that is the source of the errormessage
- The error message to be returnedprotected abstract void sendRawMessageLater(String reply) throws UserDeadException
reply
- The message to be sent in future
UserDeadException
- if the user is already goneprotected void sendRawMessageNow(String reply) throws UserDeadException
reply
- The string to be transmitted to this thread's user
UserDeadException
- if the user has been disconnectedpublic abstract void sendResponse(org.json.JSONObject result) throws UserDeadException
sendResponse
in interface CanProcessCommands
result
- a JSON-encoded response
UserDeadException
- if the user disconnectsCanProcessCommands.sendResponse(org.json.JSONObject)
public void setDebug(boolean newDebug)
newDebug
- True, if the server should be in debug mode;
else, falsepublic void setLanguage(String newLanguage, String newDialect)
newLanguage
- new languagenewDialect
- new dialectpublic void setVerboseBugReplies(boolean really)
really
- whether to enable this mode, or actually to disable
it.@Deprecated protected void superVerbose(String string)
string
- verbose debugging BSpublic void tattle(String message)
message
- messagepublic void tattle(String tattle, boolean urgent)
tattle
- the log entry to be printedurgent
- Display this message even in non-debug mode (in
logs)protected abstract String tattlePrefix()
protected void toInfinityAndBeyond()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |