org.jboss.remoting.transport.multiplex
Class MultiplexServerInvoker

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

public class MultiplexServerInvoker
extends SocketServerInvoker
implements MultiplexInvokerConstants, java.lang.Runnable, VirtualSocket.DisconnectListener

Author:
Tom Elrod, Ron Sigal

Nested Class Summary
static class MultiplexServerInvoker.SocketGroupInfo
           
 
Field Summary
protected static org.jboss.logging.Logger log
           
 
Fields inherited from class org.jboss.remoting.transport.socket.SocketServerInvoker
acceptThreads, backlog, CHECK_CONNECTION_KEY, clientpool, maxPoolSize, numAcceptThreads, running, SERVER_SOCKET_CLASS_FLAG, serverSocket, threadpool, trace
 
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, serializationType
 
Fields inherited from interface org.jboss.remoting.transport.multiplex.MultiplexInvokerConstants
CLIENT_MULTIPLEX_ID_KEY, MULTIPLEX_BIND_HOST_KEY, MULTIPLEX_BIND_PORT_KEY, MULTIPLEX_CONNECT_HOST_KEY, MULTIPLEX_CONNECT_PORT_KEY, SERVER_MULTIPLEX_ID_KEY
 
Constructor Summary
  MultiplexServerInvoker(InvokerLocator locator)
          Create a new MultiplexServerInvoker.
  MultiplexServerInvoker(InvokerLocator locator, java.util.Map configuration)
          Create a new MultiplexServerInvoker.
protected MultiplexServerInvoker(InvokerLocator locator, java.util.Map configuration, java.net.ServerSocket serverSocket, java.net.Socket socket, java.util.Map virtualServerInvokers)
          Create a new MultiplexServerInvoker.
 
Method Summary
protected  void cleanup()
           
protected  void configureSocketGroupParameters(java.util.Map parameters)
           
protected static void createPrimingSocket(MultiplexServerInvoker.SocketGroupInfo socketGroupInfo, java.lang.String connectHost, int connectPort, java.net.InetAddress bindAddress, int bindPort, javax.net.SocketFactory socketFactory, int timeout)
           
protected static void createPrimingSocket(MultiplexServerInvoker.SocketGroupInfo socketGroupInfo, java.lang.String connectHost, int connectPort, javax.net.SocketFactory socketFactory, int timeout)
           
protected  java.net.ServerSocket createServerSocket(int bindPort, int backlog, java.net.InetAddress bindAddress)
          In creating the server socket, createServerSocket() determines whether multiplexing will be supported by this ServerInvoker.
protected  javax.net.SocketFactory createSocketFactory(java.util.Map configuration)
          If any configuration parameters relate to the construction of a RemotingSSLSocketFactory, create one.
protected  void finishStart()
          FIXME Comment this
static java.util.Map getAddressPairMap()
          FIXME Comment this
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.
 MultiplexServerInvoker getServerInvoker(java.net.InetSocketAddress address)
          FIXME Comment this
 java.util.Collection getServerInvokers()
          FIXME Comment this
 java.net.ServerSocket getServerSocket()
          Returns ServerSocket used to accept invocation requests.
static java.util.Map getSocketGroupMap()
          FIXME Comment this
protected  java.lang.String getThreadName(int i)
           
 boolean isSafeToShutdown()
           
 void notifyDisconnected(VirtualSocket virtualSocket)
           
protected  void processInvocation(java.net.Socket socket)
           
 void run()
           
protected  void setBindingInfo()
          FIXME Comment this
protected  void setup()
           
 void start()
          Starts the invoker.
 void stop()
          Stops the invoker.
 
Methods inherited from class org.jboss.remoting.transport.socket.SocketServerInvoker
destroy, finalize, getBacklog, getCurrentClientPoolSize, getCurrentThreadPoolSize, getMaxPoolSize, getNumAcceptThreads, isTransportBiDirectional, setBacklog, setMaxPoolSize, setNumAcceptThreads
 
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

log

protected static final org.jboss.logging.Logger log
Constructor Detail

MultiplexServerInvoker

public MultiplexServerInvoker(InvokerLocator locator)
Create a new MultiplexServerInvoker.

Parameters:
locator -

MultiplexServerInvoker

public MultiplexServerInvoker(InvokerLocator locator,
                              java.util.Map configuration)
                       throws java.io.IOException
Create a new MultiplexServerInvoker.

Parameters:
locator -
configuration -

MultiplexServerInvoker

protected MultiplexServerInvoker(InvokerLocator locator,
                                 java.util.Map configuration,
                                 java.net.ServerSocket serverSocket,
                                 java.net.Socket socket,
                                 java.util.Map virtualServerInvokers)
Create a new MultiplexServerInvoker.

Parameters:
locator -
configuration -
serverSocket -
virtualServerInvokers - TODO
Method Detail

getAddressPairMap

public static java.util.Map getAddressPairMap()
FIXME Comment this

Returns:

getSocketGroupMap

public static java.util.Map getSocketGroupMap()
FIXME Comment this

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.

Overrides:
getDefaultDataType in class SocketServerInvoker
Returns:

start

public void start()
           throws java.io.IOException
Description copied from class: SocketServerInvoker
Starts the invoker.

Specified by:
start in interface SocketServerInvokerMBean
Overrides:
start in class SocketServerInvoker
Throws:
java.io.IOException

run

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

isSafeToShutdown

public boolean isSafeToShutdown()

notifyDisconnected

public void notifyDisconnected(VirtualSocket virtualSocket)
Specified by:
notifyDisconnected in interface VirtualSocket.DisconnectListener

stop

public void stop()
Description copied from class: SocketServerInvoker
Stops the invoker.

Specified by:
stop in interface SocketServerInvokerMBean
Overrides:
stop in class SocketServerInvoker

setup

protected void setup()
              throws java.lang.Exception
Overrides:
setup in class SocketServerInvoker
Throws:
java.lang.Exception

finishStart

protected void finishStart()
                    throws java.io.IOException
FIXME Comment this

Throws:
java.io.IOException

configureSocketGroupParameters

protected void configureSocketGroupParameters(java.util.Map parameters)
                                       throws java.io.IOException
Throws:
java.io.IOException

createPrimingSocket

protected static void createPrimingSocket(MultiplexServerInvoker.SocketGroupInfo socketGroupInfo,
                                          java.lang.String connectHost,
                                          int connectPort,
                                          javax.net.SocketFactory socketFactory,
                                          int timeout)
                                   throws java.io.IOException
Throws:
java.io.IOException

createPrimingSocket

protected static void createPrimingSocket(MultiplexServerInvoker.SocketGroupInfo socketGroupInfo,
                                          java.lang.String connectHost,
                                          int connectPort,
                                          java.net.InetAddress bindAddress,
                                          int bindPort,
                                          javax.net.SocketFactory socketFactory,
                                          int timeout)
                                   throws java.io.IOException
Throws:
java.io.IOException

getThreadName

protected java.lang.String getThreadName(int i)
Overrides:
getThreadName in class SocketServerInvoker

processInvocation

protected void processInvocation(java.net.Socket socket)
                          throws java.lang.Exception
Overrides:
processInvocation in class SocketServerInvoker
Throws:
java.lang.Exception

cleanup

protected void cleanup()
Overrides:
cleanup in class SocketServerInvoker

createServerSocket

protected java.net.ServerSocket createServerSocket(int bindPort,
                                                   int backlog,
                                                   java.net.InetAddress bindAddress)
                                            throws java.io.IOException
In creating the server socket, createServerSocket() determines whether multiplexing will be supported by this ServerInvoker. The determination is made according to the presence or absence of certain parameters in the ServerInvoker's locator. In particular, a VirtualServerSocket, which supports multiplexing, needs to connect to a remote MasterServerSocket before it can begin to accept connection requests. In order to know which MasterServerSocket to connect to, it looks for parameters "connectHost" and "connectPort" in the locator. The presence of these parameters indicates that a VirtualServerSocket should be created, and their absence indicates that a MasterServerSocket, which does not support multiplexing, should be created.

Overrides:
createServerSocket in class SocketServerInvoker
Parameters:
bindPort -
backlog -
bindAddress -
Returns:
Throws:
java.io.IOException

getServerSocket

public java.net.ServerSocket getServerSocket()
Returns ServerSocket used to accept invocation requests. It is added to facilitate unit tests.

Returns:
ServerSocket used to accept invocation requests.

getServerInvoker

public MultiplexServerInvoker getServerInvoker(java.net.InetSocketAddress address)
FIXME Comment this

Parameters:
address -
Returns:

getServerInvokers

public java.util.Collection getServerInvokers()
FIXME Comment this

Returns:

setBindingInfo

protected void setBindingInfo()
                       throws java.io.IOException
FIXME Comment this

Throws:
java.io.IOException

createSocketFactory

protected javax.net.SocketFactory createSocketFactory(java.util.Map configuration)
                                               throws java.io.IOException
If any configuration parameters relate to the construction of a RemotingSSLSocketFactory, create one.

Parameters:
configuration -
Returns:
Throws:
java.io.IOException


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