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.19.2.1 $
Author:
Jeff Haynie, Tom Elrod

Field Summary
protected  java.lang.Thread[] acceptThreads
           
protected  int backlog
           
static java.lang.String CHECK_CONNECTION_KEY
           
protected  LRUPool clientpool
           
protected  int maxPoolSize
           
protected  int numAcceptThreads
           
protected  boolean running
           
static java.lang.String SERVER_SOCKET_CLASS_FLAG
          Property value to set if want a custom socket wrapper for providing custom streams.
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, 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, TIMEOUT
 
Fields inherited from class org.jboss.remoting.AbstractInvoker
classbyteloader, configuration, localServerLocators, locator, log, serializationType
 
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
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)
           
 void run()
           
 void setBacklog(int backlog)
           
 void setMaxPoolSize(int maxPoolSize)
          The number of server threads for processing client.
 void setNumAcceptThreads(int size)
          Setter for property numAcceptThreads
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, isStarted, postProcess, preProcess, removeCallbackListener, removeConnectionListener, removeInvocationHandler, setClientConnectAddress, setClientConnectPort, setConfiguration, setLeasePeriod, setMaxNumberOfOnewayThreads, setMBeanServer, setOnewayThreadPool, setServerSocketFactory, setTimeout
 
Methods inherited from class org.jboss.remoting.AbstractInvoker
addClientLocator, getClassLoader, getClientLocator, getLocator, getSerializationType, setClassLoader, setSerializationType
 
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
See Also:
Constant Field Values

SERVER_SOCKET_CLASS_FLAG

public static final java.lang.String SERVER_SOCKET_CLASS_FLAG
Property value to set if want a custom socket wrapper for providing custom streams.

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

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

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()

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.