|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.radekzitek.userver.HandlerThread
Handler thread is a base class for handler implementation.
Field Summary | |
protected java.net.Socket |
client
The socket of the connected client. |
private HandlerPool |
hp
Handler pool managing this handler. |
private java.lang.String |
id
Unique id for the handler. |
private static org.apache.log4j.Logger |
LOG
Log4j logger. |
Constructor Summary | |
HandlerThread()
|
Method Summary | |
void |
handle(java.net.Socket client)
The method called by the listener to request the handler to handle the client socket connection. |
protected abstract void |
localRun()
The prototype for the localRun of the implementing class. |
void |
registerHandlerPool(HandlerPool hp)
Called by the HandlerPool after the new thread is created to make sure the threat knows where to return itself. |
void |
run()
The actuall thread execution method. |
void |
setId(java.lang.String id)
Used to set the unique id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.log4j.Logger LOG
protected java.net.Socket client
private HandlerPool hp
private java.lang.String id
Constructor Detail |
public HandlerThread()
Method Detail |
public void registerHandlerPool(HandlerPool hp)
hp
- the handler pool managing this handlerpublic void setId(java.lang.String id)
id
- the idpublic void run()
run
in interface java.lang.Runnable
Runnable.run()
protected abstract void localRun() throws HandlerThreadException
HandlerThreadException
- Thrown by the implementing class in case it encounter any
unforeseen troubl.public void handle(java.net.Socket client)
client
- the client socket
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |