|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
netbattle.MessageHandler
public abstract class MessageHandler
Processes input from a socket.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.io.ObjectInputStream |
m_input
|
protected java.io.ObjectOutputStream |
m_output
|
protected java.net.Socket |
m_socket
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
protected |
MessageHandler()
Prevents creation of MessageHandler externally. |
Method Summary | |
---|---|
protected abstract void |
executeMessage(NetMessage msg)
Exexcute a message. |
NetMessage |
getNextMessage()
Pull a message off the queue, with the default timeout. |
NetMessage |
getNextMessage(int timeout)
Pull a message off the queue, with the specified timeout. |
protected abstract void |
informReadError(java.lang.Throwable e)
Inform of a read error. |
protected void |
informWriteError(java.io.IOException e)
Inform of a write error. |
protected boolean |
isRunning()
|
void |
run()
|
void |
sendMessage(NetMessage message)
Send a message. |
void |
sendMessage(java.lang.Runnable message)
Send a runnable message. |
protected void |
stopRunning()
|
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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.net.Socket m_socket
protected java.io.ObjectInputStream m_input
protected java.io.ObjectOutputStream m_output
Constructor Detail |
---|
protected MessageHandler()
Method Detail |
---|
protected boolean isRunning()
protected void stopRunning()
protected abstract void executeMessage(NetMessage msg)
protected abstract void informReadError(java.lang.Throwable e)
protected void informWriteError(java.io.IOException e)
public void sendMessage(java.lang.Runnable message)
public void sendMessage(NetMessage message)
public NetMessage getNextMessage() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public NetMessage getNextMessage(int timeout) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |