|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
vooga.engine.networking.server.Handler
public abstract class Handler
Class that handles communicating over the network. Handler extends Thread and has a socket to send and receive chats through as well as a session ID to group Handlers that are part of the same game session. Subclasses will need to override the run method to put the code that sends and receives messages using the socket.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected int |
sessionID
|
protected GameSocket |
socket
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Handler(GameSocket socket,
int sessionID)
Initializes a Handler with a socket to communicate through and a gameNumber that represents the handler's game session's id. |
Method Summary | |
---|---|
int |
getSessionID()
|
GameSocket |
getSocket()
|
abstract void |
run()
Called once the thread is started. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, 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 |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected GameSocket socket
protected int sessionID
Constructor Detail |
---|
public Handler(GameSocket socket, int sessionID)
Method Detail |
---|
public abstract void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public int getSessionID()
public GameSocket getSocket()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |