org.jboss.remoting.transport.socket
Class SocketServerInvoker

java.lang.Object
  extended byorg.jboss.remoting.AbstractInvoker
      extended byorg.jboss.remoting.ServerInvoker
          extended byorg.jboss.remoting.transport.socket.SocketServerInvoker
All Implemented Interfaces:
Invoker, java.lang.Runnable, ServerInvokerMBean, SocketServerInvokerMBean
Direct Known Subclasses:
MultiplexServerInvoker, SSLSocketServerInvoker

public class SocketServerInvoker
extends ServerInvoker
implements java.lang.Runnable, SocketServerInvokerMBean

SocketServerInvoker is the server-side of a SOCKET based transport

Version:
$Revision: 1.29 $
Author:
Jeff Haynie, Tom Elrod

Nested Class Summary
 class SocketServerInvoker.ServerSocketRefresh
          this thread checks if a new ServerSocketFactory was set,
if so initializes a serversocket refresh
 
Nested classes inherited from class org.jboss.remoting.ServerInvoker
ServerInvoker.InvalidStateException
 
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 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.util.LinkedList threadpool
           
protected  boolean trace
          The logging trace level flag
 
Fields inherited from class org.jboss.remoting.ServerInvoker
callbackHandlers, CLIENT_CONNECT_ADDRESS_KEY, CLIENT_CONNECT_PORT_KEY, CLIENT_LEASE_PERIOD, clientCallbackListener, DEFAULT_CLIENT_LEASE_PERIOD, DEFAULT_TIMEOUT_PERIOD, handlers, MAX_NUM_ONEWAY_THREADS, MAX_NUM_ONEWAY_THREADS_KEY, ONEWAY_THREAD_POOL_CLASS_KEY, SERVER_BIND_ADDRESS_KEY, SERVER_BIND_PORT_KEY, SERVER_SOCKET_FACTORY, serverSocketFactory, TIMEOUT
 
Fields inherited from class org.jboss.remoting.AbstractInvoker
classbyteloader, configuration, localServerLocators, locator, log, 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 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)
           
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 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.
 
Methods inherited from class org.jboss.remoting.ServerInvoker
addConnectionListener, addInvocationHandler, create, createServerSocketFactory, getClientConnectAddress, getClientConnectPort, getConfiguration, getDataType, getDefaultServerSocketFactory, getInvocationHandler, getInvocationHandlers, getLeasePeriod, getMaxNumberOfOnewayThreads, getMBeanObjectName, getMBeanServer, getOnewayThreadPool, getServerBindAddress, getServerBindPort, getServerSocketFactory, getSupportedSubsystems, getTimeout, hasInvocationHandler, invoke, invoke, isLeaseActivated, isStarted, justNeedsSSLClientMode, postProcess, preProcess, removeCallbackListener, removeConnectionListener, removeInvocationHandler, setClientConnectAddress, setClientConnectPort, setConfiguration, setLeasePeriod, setMaxNumberOfOnewayThreads, setMBeanServer, setOnewayThreadPool, setServerSocketFactory, setTimeout
 
Methods inherited from class org.jboss.remoting.AbstractInvoker
addClientLocator, createSocketFactory, getClassLoader, getClientLocator, getLocator, getSerializationType, getSocketFactory, isSocketFactoryCreatedFromSSLParameters, needsCustomSSLConfiguration, setClassLoader, setSerializationType, setSocketFactory
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, 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

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

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

reuseAddress

protected boolean reuseAddress

trace

protected boolean trace
The logging trace level flag

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
Throws:
java.lang.Throwable

start

public void start()
           throws java.io.IOException
Starts the invoker.

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 interface: ServerInvokerMBean
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 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.

Returns:

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

run

public void run()
Specified by:
run in interface java.lang.Runnable

processInvocation

protected void processInvocation(java.net.Socket socket)
                          throws java.lang.Exception
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:

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
Returns:


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