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 SocketServerInvoker

    java.lang.Object
      org.jboss.remoting.AbstractInvoker
          org.jboss.remoting.ServerInvoker
              org.jboss.remoting.transport.socket.SocketServerInvoker

All Implemented Interfaces:
  java.lang.Runnable, Invoker, ServerInvokerMBean, SocketServerInvokerMBean

Direct Known Subclasses:
  BisocketServerInvoker, MultiplexServerInvoker, SSLSocketServerInvoker

    public class SocketServerInvoker

extends ServerInvoker
implements java.lang.Runnable, SocketServerInvokerMBean

SocketServerInvoker is the server-side of a SOCKET based transport

Version:
  $Revision: 2603 $
Author:
  Jeff Haynie, Tom Elrod, Ovidiu Feodorov

Nested Class Summary
`class` | `SocketServerInvoker.IdleTimerTask` The IdleTimerTask is used to periodically check the server threads to see if any have been idle for a specified amount of time, and if so, release those threads and their connections and clear from the server thread pool.
`class` | `SocketServerInvoker.ServerSocketRefresh` this thread checks if a new ServerSocketFactory was set, if so initializes a serversocket refresh

Nested classes/interfaces inherited from class org.jboss.remoting.ServerInvoker
`ServerInvoker.InvalidStateException`

Nested classes/interfaces inherited from class org.jboss.remoting.AbstractInvoker
`AbstractInvoker.CallbackLocatorHolder`

Field Summary
`protected java.lang.Thread[]` | `acceptThreads`
`protected int` | `backlog`
`static java.lang.String` | `CHECK_CONNECTION_KEY` Key for indicating if socket invoker should continue to keep socket connection between client and server open after invocations by sending a ping on the connection before being re-used.
`protected LRUPool` | `clientpool`
`protected int` | `idleTimeout`
`protected SocketServerInvoker.IdleTimerTask` | `idleTimerTask`
`protected static int` | `MAX_POOL_SIZE_DEFAULT`
`protected int` | `maxPoolSize`
`protected boolean` | `newServerSocketFactory`
`protected int` | `numAcceptThreads`
`protected boolean` | `reuseAddress`
`protected boolean` | `running`
`static java.lang.String` | `SERVER_SOCKET_CLASS_FLAG` Specifies the fully qualified class name for the custom SocketWrapper implementation to use on the server.
`protected java.net.ServerSocket` | `serverSocket`
`protected java.lang.String` | `serverSocketClass`
`protected java.lang.Object` | `serverSocketFactoryLock`
`protected java.util.LinkedList` | `threadpool`

Fields inherited from class org.jboss.remoting.ServerInvoker
`BLOCKING, BLOCKING_MODE, BLOCKING_TIMEOUT, callbackHandlers, CLIENT_CONNECT_ADDRESS_KEY, CLIENT_CONNECT_PORT_KEY, CLIENT_LEASE_PERIOD, clientCallbackListener, connectionNotifier, DEFAULT_BLOCKING_TIMEOUT, DEFAULT_CLIENT_LEASE_PERIOD, DEFAULT_TIMEOUT_PERIOD, handlers, INVOKER_SESSION_ID, MAX_NUM_ONEWAY_THREADS, MAX_NUM_ONEWAY_THREADS_KEY, MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE, NONBLOCKING, ONEWAY_THREAD_POOL_CLASS_KEY, REGISTER_CALLBACK_LISTENER, registerCallbackListeners, SERVER_BIND_ADDRESS_KEY, SERVER_BIND_PORT_KEY, SERVER_SOCKET_FACTORY, serverSocketFactory, singleCallbackContainer, singleHandler, started, TIMEOUT`

Fields inherited from class org.jboss.remoting.AbstractInvoker
`classbyteloader, configuration, localServerLocators, locator, serializationType, socketFactory, socketFactoryCreatedFromSSLParameters`

Constructor Summary
`SocketServerInvoker(InvokerLocator locator)`
`SocketServerInvoker(InvokerLocator locator, java.util.Map configuration)`

Method Summary
`protected void` | `cleanup()`
`protected java.net.ServerSocket` | `createServerSocket(int serverBindPort, int backlog, java.net.InetAddress bindAddress)`
`void` | `destroy()` Destory the invoker permanently.
`protected void` | `finalize()`
`int` | `getBacklog()`
`int` | `getCurrentClientPoolSize()`
`int` | `getCurrentThreadPoolSize()`
`protected java.lang.String` | `getDefaultDataType()` Each implementation of the remote client invoker should have a default data type that is uses in the case it is not specified in the invoker locator uri.
`int` | `getIdleTimeout()`
`int` | `getMaxPoolSize()` Setter for max pool size.
`int` | `getNumAcceptThreads()` Getter for property numAcceptThreads
`boolean` | `getReuseAddress()` Indicates if SO_REUSEADDR is enabled on server sockets Default is true.
`protected java.lang.String` | `getThreadName(int i)`
`boolean` | `isTransportBiDirectional()` returns true if the transport is bi-directional in nature, for example, SOAP in unidirectional and SOCKETs are bi-directional (unless behind a firewall for example).
`protected void` | `processInvocation(java.net.Socket socket)` The acceptor thread should spend as little time as possbile doing any kind of operation, and under no circumstances should perform IO on the new socket, which can potentially block and lock up the server.
`protected void` | `refreshServerSocket()` refreshes the serverSocket by closing old one and creating a new ServerSocket from new ServerSocketFactory
`void` | `run()`
`void` | `setBacklog(int backlog)`
`void` | `setIdleTimeout(int idleTimeout)` Sets the timeout for idle threads to be removed from pool.
`void` | `setMaxPoolSize(int maxPoolSize)` The number of server threads for processing client.
`void` | `setNewServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)` after a truststore update use this to set a new ServerSocketFactory to the invoker then a new ServerSocket is created that accepts the new connections
`void` | `setNumAcceptThreads(int size)` Setter for property numAcceptThreads
`void` | `setReuseAddress(boolean reuse)` Sets if SO_REUSEADDR is enabled on server sockets.
`protected void` | `setup()`
`void` | `start()` Starts the invoker.
`void` | `stop()` Stops the invoker.
`java.lang.String` | `toString()`

Methods inherited from class org.jboss.remoting.ServerInvoker
`addConnectionListener, addInvocationHandler, assignPort, create, createServerSocketFactory, getClientConnectAddress, getClientConnectPort, getConfiguration, getDataType, getDefaultServerSocketFactory, getInvocationHandler, getInvocationHandlers, getLease, getLeasePeriod, getMaxNumberOfOnewayThreads, getMBeanObjectName, getMBeanServer, getOnewayThreadPool, getServerBindAddress, getServerBindPort, getServerSocketFactory, getSupportedSubsystems, getTimeout, handleInternalInvocation, hasInvocationHandler, invoke, invoke, isLeaseActivated, isRegisterCallbackListeners, isStarted, justNeedsSSLClientMode, postProcess, preProcess, removeCallbackListener, removeConnectionListener, removeInvocationHandler, setClientConnectAddress, setClientConnectPort, setConfiguration, setLeasePeriod, setMaxNumberOfOnewayThreads, setMBeanServer, setOnewayThreadPool, setRegisterCallbackListeners, setServerSocketFactory, setTimeout, wrapServerSocketFactory`

Methods inherited from class org.jboss.remoting.AbstractInvoker
`addClientLocator, createSocketFactory, getClassLoader, getClientLocator, getClientLocators, getLocator, getSerializationType, getSocketFactory, isCompleteSocketFactory, isSocketFactoryCreatedFromSSLParameters, needsCustomSSLConfiguration, setClassLoader, setSerializationType, setSocketFactory, wrapSocketFactory`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.jboss.remoting.transport.socket.SocketServerInvokerMBean
`getServerBindPort`

Methods inherited from interface org.jboss.remoting.ServerInvokerMBean
`create, getClientConnectAddress, getClientConnectPort, getConfiguration, getDataType, getServerBindAddress, getTimeout, isStarted, setClientConnectAddress, setClientConnectPort, setConfiguration, setTimeout`

Field Detail

### MAX_POOL_SIZE_DEFAULT

    protected static int MAX_POOL_SIZE_DEFAULT

### CHECK_CONNECTION_KEY

    public static final java.lang.String CHECK_CONNECTION_KEY

  Key for indicating if socket invoker should continue to keep socket connection between client and server open after invocations by sending a ping on the connection before being re-used. The default for this is false.

  See Also:
    Constant Field Values

### SERVER_SOCKET_CLASS_FLAG

    public static final java.lang.String SERVER_SOCKET_CLASS_FLAG

  Specifies the fully qualified class name for the custom SocketWrapper implementation to use on the server.

  See Also:
    Constant Field Values

### serverSocketClass

    protected java.lang.String serverSocketClass

### serverSocket

    protected java.net.ServerSocket serverSocket

### running

    protected boolean running

### backlog

    protected int backlog

### acceptThreads

    protected java.lang.Thread[] acceptThreads

### numAcceptThreads

    protected int numAcceptThreads

### maxPoolSize

    protected int maxPoolSize

### clientpool

    protected LRUPool clientpool

### threadpool

    protected java.util.LinkedList threadpool

### newServerSocketFactory

    protected boolean newServerSocketFactory

### serverSocketFactoryLock

    protected java.lang.Object serverSocketFactoryLock

### reuseAddress

    protected boolean reuseAddress

### idleTimeout

    protected int idleTimeout

### idleTimerTask

    protected SocketServerInvoker.IdleTimerTask idleTimerTask

Constructor Detail

### SocketServerInvoker

    public SocketServerInvoker(InvokerLocator locator)

### SocketServerInvoker

    public SocketServerInvoker(InvokerLocator locator,
                               java.util.Map configuration)

Method Detail

### setNewServerSocketFactory

    public void setNewServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)

  after a truststore update use this to set a new ServerSocketFactory to the invoker
  then a new ServerSocket is created that accepts the new connections

  Parameters:
    `serverSocketFactory` -

### refreshServerSocket

    protected void refreshServerSocket()
                                throws java.io.IOException

  refreshes the serverSocket by closing old one and creating a new ServerSocket from new ServerSocketFactory

  Throws:
    `java.io.IOException`

### setup

    protected void setup()
                  throws java.lang.Exception

  Overrides:
    `setup` in class `ServerInvoker`
  Throws:
    `java.lang.Exception`

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Overrides:
    `finalize` in class `java.lang.Object`
  Throws:
    `java.lang.Throwable`

### start

    public void start()
               throws java.io.IOException

  Starts the invoker.

  Specified by:
    `start` in interface `ServerInvokerMBean`
  Specified by:
    `start` in interface `SocketServerInvokerMBean`
  Overrides:
    `start` in class `ServerInvoker`
  Throws:
    `java.io.IOException`

### createServerSocket

    protected java.net.ServerSocket createServerSocket(int serverBindPort,
                                                       int backlog,
                                                       java.net.InetAddress bindAddress)
                                                throws java.io.IOException

  Throws:
    `java.io.IOException`

### getThreadName

    protected java.lang.String getThreadName(int i)

### destroy

    public void destroy()

  Description copied from class: `ServerInvoker`
  Destory the invoker permanently.

  Specified by:
    `destroy` in interface `ServerInvokerMBean`
  Overrides:
    `destroy` in class `ServerInvoker`

### stop

    public void stop()

  Stops the invoker.

  Specified by:
    `stop` in interface `ServerInvokerMBean`
  Specified by:
    `stop` in interface `SocketServerInvokerMBean`
  Overrides:
    `stop` in class `ServerInvoker`

### cleanup

    protected void cleanup()

### getReuseAddress

    public boolean getReuseAddress()

  Indicates if SO_REUSEADDR is enabled on server sockets Default is true.

### setReuseAddress

    public void setReuseAddress(boolean reuse)

  Sets if SO_REUSEADDR is enabled on server sockets. Default is true.

  Parameters:
    `reuse` -

### getCurrentThreadPoolSize

    public int getCurrentThreadPoolSize()

  Specified by:
    `getCurrentThreadPoolSize` in interface `SocketServerInvokerMBean`
  Returns:
    Value of property serverBindPort.

### getCurrentClientPoolSize

    public int getCurrentClientPoolSize()

  Specified by:
    `getCurrentClientPoolSize` in interface `SocketServerInvokerMBean`
  Returns:
    Value of property serverBindPort.

### getNumAcceptThreads

    public int getNumAcceptThreads()

  Getter for property numAcceptThreads

  Specified by:
    `getNumAcceptThreads` in interface `SocketServerInvokerMBean`
  Returns:
    The number of threads that exist for accepting client connections

### setNumAcceptThreads

    public void setNumAcceptThreads(int size)

  Setter for property numAcceptThreads

  Specified by:
    `setNumAcceptThreads` in interface `SocketServerInvokerMBean`
  Parameters:
    `size` - The number of threads that exist for accepting client connections

### getMaxPoolSize

    public int getMaxPoolSize()

  Setter for max pool size. The number of server threads for processing client. The default is 300.

  Specified by:
    `getMaxPoolSize` in interface `SocketServerInvokerMBean`
  Returns:

### setMaxPoolSize

    public void setMaxPoolSize(int maxPoolSize)

  The number of server threads for processing client. The default is 300.

  Specified by:
    `setMaxPoolSize` in interface `SocketServerInvokerMBean`
  Parameters:
    `maxPoolSize` -

### getBacklog

    public int getBacklog()

  Specified by:
    `getBacklog` in interface `SocketServerInvokerMBean`

### setBacklog

    public void setBacklog(int backlog)

  Specified by:
    `setBacklog` in interface `SocketServerInvokerMBean`

### getIdleTimeout

    public int getIdleTimeout()

### setIdleTimeout

    public void setIdleTimeout(int idleTimeout)

  Sets the timeout for idle threads to be removed from pool. If the value is greater than 0, then idle timeout will be activated, otherwise no idle timeouts will occur. By default, this value is -1.

  Parameters:
    `idleTimeout` - number of seconds before a idle thread is timed out.

### run

    public void run()

  Specified by:
    `run` in interface `java.lang.Runnable`

### processInvocation

    protected void processInvocation(java.net.Socket socket)
                              throws java.lang.Exception

  The acceptor thread should spend as little time as possbile doing any kind of operation, and under no circumstances should perform IO on the new socket, which can potentially block and lock up the server. For this reason, the acceptor thread should grab a worker thread and delegate all subsequent work to it.

  Throws:
    `java.lang.Exception`

### isTransportBiDirectional

    public boolean isTransportBiDirectional()

  returns true if the transport is bi-directional in nature, for example, SOAP in unidirectional and SOCKETs are bi-directional (unless behind a firewall for example).

  Specified by:
    `isTransportBiDirectional` in interface `ServerInvokerMBean`
  Returns:

### toString

    public java.lang.String toString()

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

### getDefaultDataType

    protected java.lang.String getDefaultDataType()

  Each implementation of the remote client invoker should have a default data type that is uses in the case it is not specified in the invoker locator uri.

  Specified by:
    `getDefaultDataType` in class `ServerInvoker`

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.