|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.jboss.remoting.transport.socket.ServerThread
public class ServerThread
This Thread object hold a single Socket connection to a client and is kept alive until a timeout happens, or it is aged out of the SocketServerInvoker's LRU cache.
There is also a separate thread pool that is used if the client disconnects. This thread/object is re-used in that scenario and that scenario only. This is a customization of the same ServerThread class used witht the PookedInvoker. The custimization was made to allow for remoting marshaller/unmarshaller.
Nested Class Summary | |
---|---|
static class |
ServerThread.AcknowledgeFailure
|
static class |
ServerThread.EvictionException
|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected LRUPool |
clientpool
|
static java.lang.String |
CONTINUE_AFTER_TIMEOUT
Key used to determine if thread should return to threadpool after SocketTimeoutException |
protected long |
enteredEvictable
|
static java.lang.String |
EVICTABILITY_TIMEOUT
Used to configure period during which ServerThread is not evictable on first invocation even when in evictable state. |
static int |
EVICTABILITY_TIMEOUT_DEFAULT
|
protected boolean |
evictable
|
protected java.lang.Object |
evictionLock
|
protected SocketServerInvoker |
invoker
|
protected Marshaller |
marshaller
|
protected boolean |
performVersioning
|
protected boolean |
running
|
protected java.lang.Class |
serverSocketClass
|
protected java.lang.String |
serverSocketClassName
|
protected boolean |
shutdown
|
protected SocketWrapper |
socketWrapper
|
protected java.util.LinkedList |
threadpool
|
protected UnMarshaller |
unmarshaller
|
protected int |
version
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ServerThread(java.net.Socket socket,
SocketServerInvoker invoker,
LRUPool clientpool,
java.util.LinkedList threadpool,
int timeout,
java.lang.String serverSocketClassName)
|
Method Summary | |
---|---|
protected void |
acknowledge(SocketWrapper socketWrapper)
|
protected void |
completeInvocation(SocketWrapper socketWrapper,
java.io.InputStream inputStream,
java.io.OutputStream outputStream,
boolean performVersioning,
int version)
|
protected void |
dorun()
This is needed because Object*Streams leak |
boolean |
evict()
If this ServerThread is in acknowledge() or readVersion(), evict() will close the socket so that thread returns itself to threadpool. |
boolean |
getCheckingConnection()
Indicates if server will check with client (via an ACK) to see if is still there. |
long |
getLastRequestTimestamp()
|
static int |
nextID()
|
protected void |
processInvocation(SocketWrapper socketWrapper,
java.io.InputStream inputStream,
java.io.OutputStream outputStream)
|
void |
run()
|
void |
shouldCheckConnection(boolean checkConnection)
Sets if server thread should check connection before continue to process on next invocation request. |
void |
shutdown()
|
java.lang.String |
toString()
This method is intended to be used when need to unblock I/O read, which the thread will automatically loop back to do after processing a request. |
protected java.lang.Object |
versionedRead(java.io.InputStream inputStream,
ServerInvoker invoker,
java.lang.ClassLoader classLoader,
int version)
|
void |
wakeup(java.net.Socket socket,
int timeout,
SocketServerInvoker invoker)
|
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, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EVICTABILITY_TIMEOUT
public static final int EVICTABILITY_TIMEOUT_DEFAULT
public static final java.lang.String CONTINUE_AFTER_TIMEOUT
protected volatile boolean running
protected volatile boolean shutdown
protected boolean evictable
protected long enteredEvictable
protected java.lang.Object evictionLock
protected LRUPool clientpool
protected java.util.LinkedList threadpool
protected java.lang.String serverSocketClassName
protected java.lang.Class serverSocketClass
protected SocketServerInvoker invoker
protected SocketWrapper socketWrapper
protected Marshaller marshaller
protected UnMarshaller unmarshaller
protected int version
protected boolean performVersioning
Constructor Detail |
---|
public ServerThread(java.net.Socket socket, SocketServerInvoker invoker, LRUPool clientpool, java.util.LinkedList threadpool, int timeout, java.lang.String serverSocketClassName) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public static int nextID()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void wakeup(java.net.Socket socket, int timeout, SocketServerInvoker invoker) throws java.lang.Exception
java.lang.Exception
public long getLastRequestTimestamp()
public void shutdown()
public void shouldCheckConnection(boolean checkConnection)
public boolean getCheckingConnection()
public boolean evict()
public java.lang.String toString()
toString
in class java.lang.Thread
protected void dorun()
protected void processInvocation(SocketWrapper socketWrapper, java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.lang.Exception
java.lang.Exception
protected void completeInvocation(SocketWrapper socketWrapper, java.io.InputStream inputStream, java.io.OutputStream outputStream, boolean performVersioning, int version) throws java.lang.Exception
java.lang.Exception
protected void acknowledge(SocketWrapper socketWrapper) throws java.lang.Exception
java.lang.Exception
protected java.lang.Object versionedRead(java.io.InputStream inputStream, ServerInvoker invoker, java.lang.ClassLoader classLoader, int version) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |