Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.remoting.transport.socket
Class ServerThread

    java.lang.Object
      java.lang.Thread
          org.jboss.remoting.transport.socket.ServerThread

All Implemented Interfaces:
  java.lang.Runnable

    public class ServerThread

extends java.lang.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: 3807 $
Author:
  Bill Burke, Tom Elrod, Ovidiu Feodorov

Nested Class Summary
`static class` | `ServerThread.AcknowledgeFailure`

Nested classes/interfaces inherited from class java.lang.Thread
`java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

Field Summary
`protected LRUPool` | `clientpool`
`protected boolean` | `handlingResponse`
`protected SocketServerInvoker` | `invoker`
`protected Marshaller` | `marshaller`
`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`

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` | `dorun()` This is needed because Object*Streams leak
`void` | `evict()`
`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)`
`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()`
`void` | `unblock()` 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

### running

    protected volatile boolean running

### handlingResponse

    protected volatile boolean handlingResponse

### shutdown

    protected volatile boolean shutdown

### clientpool

    protected LRUPool clientpool

### threadpool

    protected java.util.LinkedList threadpool

### serverSocketClassName

    protected java.lang.String serverSocketClassName

### serverSocketClass

    protected java.lang.Class serverSocketClass

### invoker

    protected SocketServerInvoker invoker

### socketWrapper

    protected SocketWrapper socketWrapper

### marshaller

    protected Marshaller marshaller

### unmarshaller

    protected UnMarshaller unmarshaller

Constructor Detail

### ServerThread

    public ServerThread(java.net.Socket socket,
                        SocketServerInvoker invoker,
                        LRUPool clientpool,
                        java.util.LinkedList threadpool,
                        int timeout,
                        java.lang.String serverSocketClassName)
                 throws java.lang.Exception

Throws:
  `java.lang.Exception`

Method Detail

### nextID

    public static int nextID()

### run

    public void run()

  Specified by:
    `run` in interface `java.lang.Runnable`
  Overrides:
    `run` in class `java.lang.Thread`

### wakeup

    public void wakeup(java.net.Socket socket,
                       int timeout,
                       SocketServerInvoker invoker)
                throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### getLastRequestTimestamp

    public long getLastRequestTimestamp()

### shutdown

    public void shutdown()

### shouldCheckConnection

    public void shouldCheckConnection(boolean checkConnection)

  Sets if server thread should check connection before continue to process on next invocation request. If is set to true, will send an ACK to client to verify client is still connected on same socket.

### getCheckingConnection

    public boolean getCheckingConnection()

  Indicates if server will check with client (via an ACK) to see if is still there.

### evict

    public void evict()

### unblock

    public void unblock()

  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.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Thread`

### dorun

    protected void dorun()

  This is needed because Object*Streams leak

### processInvocation

    protected void processInvocation(SocketWrapper socketWrapper)
                              throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### acknowledge

    protected void acknowledge(SocketWrapper socketWrapper)
                        throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### versionedRead

    protected java.lang.Object versionedRead(java.io.InputStream inputStream,
                                             ServerInvoker invoker,
                                             java.lang.ClassLoader classLoader,
                                             int version)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException

  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ? 1998-2005 JBoss Inc . All Rights Reserved.