|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread atg.core.util.DictionaryThread atg.server.tcp.RequestServerHandler
public class RequestServerHandler
This is the base class for objects that handle individual requests. Subclasses should override handleRequest().
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
protected RequestServer |
mServer
The RequestServer that this belongs to |
protected boolean |
mShuttingDown
Flag if we are in the process of shutting down |
protected java.net.Socket |
mSocket
The Socket this should use, if a one-shot handler |
protected boolean |
mWaitingForClient
Flag set to true if we are in the middle of waiting for the client. |
protected boolean |
mZombie
Flag showing if this server has been killed |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
RequestServerHandler(java.lang.ThreadGroup pGroup,
java.lang.String pThreadName,
RequestServer pServer,
java.net.Socket pSocket)
Constructs a new RequestServerHandler that belongs to the specified RequestServer. |
Method Summary | |
---|---|
long |
getCurrentRequestStartTime()
Returns the time at which the request began processing |
boolean |
getHandlingRequest()
Returns the flag indicating if this is currently handling a request |
long |
getRequestLastActivityTime()
Returns the last time activity occurred on this request |
RequestServer |
getRequestServer()
Returns the RequestServer this handler was created from |
boolean |
getShuttingDown()
Returns the flag indicating if this is currently shutting down |
boolean |
getWaitingForClient()
Returns true if we are in the middle of writing data to the client. |
boolean |
getZombie()
Returns the flag indicating if this thread has been killed. |
protected void |
handlerCleanup()
Called before this handler exits. |
protected void |
handleRequest(java.net.Socket pSocket)
This is the method that actually handles the request from the specified socket. |
void |
killHandler()
Kills this thread. |
static void |
logErrorForException(java.lang.Throwable t,
ApplicationLogging pLogger,
boolean bSkipTopException)
Use log error to log the exception, following the cain of container exceptions. |
void |
run()
Runs this handler. |
void |
setCurrentRequestStartTime(long pCurrentRequestStartTime)
Sets the time at which the request began processing |
void |
setHandlingRequest(boolean pHandlingRequest)
Sets the flag indicating if this is currently handling a request |
void |
setRequestLastActivityTime(long pRequestLastActivityTime)
Sets the last time activity occurred on this request |
void |
setShuttingDown(boolean pShuttingDown)
Sets the flag indicating if this is currently shutting down |
void |
setWaitingForClient(boolean pWaitingForClient)
Sets the flag indicating if this is currently waiting for the client. |
void |
setZombie(boolean pZombie)
Sets the flag indicating if this thread has been killed. |
Methods inherited from class atg.core.util.DictionaryThread |
---|
getDictionary, getObject, getThreadDictionary |
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 |
---|
public static java.lang.String CLASS_VERSION
protected RequestServer mServer
protected java.net.Socket mSocket
protected boolean mShuttingDown
protected boolean mWaitingForClient
protected boolean mZombie
Constructor Detail |
---|
public RequestServerHandler(java.lang.ThreadGroup pGroup, java.lang.String pThreadName, RequestServer pServer, java.net.Socket pSocket)
pGroup
- the ThreadGroup to which this will belongpThreadName
- the name that should be given to this ThreadpServer
- the RequestServer handling thispSocket
- the socket this should use to handle its request.
If non-null, then this handler's run method should handle a
single request from the socket and exist. If null, then the
handler's run method should repeatedly obtain sockets and handle
requests from the server by calling "acceptConnection".Method Detail |
---|
public RequestServer getRequestServer()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void handleRequest(java.net.Socket pSocket)
Note for subclasses overriding handleRequest(). You must check the mShuttingDown field if you enter into an inner loop. Otherwize the RequestServer may be forced during shutdown to kill your thread even while you are handling a request.
public void killHandler()
public boolean getHandlingRequest()
public void setHandlingRequest(boolean pHandlingRequest)
public boolean getShuttingDown()
public void setShuttingDown(boolean pShuttingDown)
public boolean getZombie()
public void setZombie(boolean pZombie)
public boolean getWaitingForClient()
public void setWaitingForClient(boolean pWaitingForClient)
public long getCurrentRequestStartTime()
public void setCurrentRequestStartTime(long pCurrentRequestStartTime)
public long getRequestLastActivityTime()
public void setRequestLastActivityTime(long pRequestLastActivityTime)
protected void handlerCleanup()
public static void logErrorForException(java.lang.Throwable t, ApplicationLogging pLogger, boolean bSkipTopException)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |