org.jboss.remoting.transport.socket
Class ServerThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.jboss.remoting.transport.socket.ServerThread
All Implemented Interfaces:
Runnable

public class ServerThread
extends Thread

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.

Version:
$Revision: 1.9 $
Author:
Bill Burke, Tom Elrod

Field Summary
protected  BufferedInputStream bis
           
protected  BufferedOutputStream bos
           
protected  LRUPool clientpool
           
protected  boolean handlingResponse
           
protected static int id
           
protected  ObjectInputStream in
           
protected  SocketServerInvoker invoker
           
protected  ObjectOutputStream out
           
protected  boolean running
           
protected  boolean shutdown
           
protected  Socket socket
           
protected  LinkedList threadpool
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerThread(Socket socket, SocketServerInvoker invoker, LRUPool clientpool, LinkedList threadpool, int timeout)
           
 
Method Summary
protected  void acknowledge()
           
protected  void dorun()
          This is needed because Object*Streams leak
 void evict()
           
static int nextID()
           
protected  void processInvocation()
           
 void run()
           
 void shutdown()
           
 void wakeup(Socket socket, int timeout)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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

bis

protected BufferedInputStream bis

bos

protected BufferedOutputStream bos

in

protected ObjectInputStream in

out

protected ObjectOutputStream out

socket

protected Socket socket

invoker

protected SocketServerInvoker invoker

clientpool

protected LRUPool clientpool

threadpool

protected LinkedList threadpool

running

protected volatile boolean running

handlingResponse

protected volatile boolean handlingResponse

shutdown

protected volatile boolean shutdown

id

protected static int id
Constructor Detail

ServerThread

public ServerThread(Socket socket,
                    SocketServerInvoker invoker,
                    LRUPool clientpool,
                    LinkedList threadpool,
                    int timeout)
             throws Exception
Method Detail

nextID

public static int nextID()

shutdown

public void shutdown()

evict

public void evict()

wakeup

public void wakeup(Socket socket,
                   int timeout)
            throws Exception
Throws:
Exception

run

public void run()

acknowledge

protected void acknowledge()
                    throws Exception
Throws:
Exception

processInvocation

protected void processInvocation()
                          throws Exception
Throws:
Exception

dorun

protected void dorun()
This is needed because Object*Streams leak



Copyright © 2004 JBoss Inc. All Rights Reserved.