org.jboss.remoting
Class ServerInvoker

java.lang.Object
  extended byorg.jboss.remoting.AbstractInvoker (src) 
      extended byorg.jboss.remoting.ServerInvoker
All Implemented Interfaces:
Invoker (src) , ServerInvokerMBean (src)
Direct Known Subclasses:
HTTPServerInvoker (src) , RMIServerInvoker (src) , SocketServerInvoker (src)

public abstract class ServerInvoker
extends AbstractInvoker (src)
implements ServerInvokerMBean (src)

ServerInvoker is the server-side part of a remote Invoker. The ServerInvoker implementation is responsible for calling transport, depending on how the protocol receives the incoming data.


Field Summary
protected  java.util.Map callbackHandlers
           
protected  java.util.Map handlers
           
static int MAX_NUM_ONEWAY_THREADS
          The max number of worker threads to be used in the pool for processing one way calls on the server side.
 
Fields inherited from class org.jboss.remoting.AbstractInvoker (src)
classbyteloader, localServerLocator, locator, log
 
Constructor Summary
ServerInvoker(InvokerLocator (src)  locator)
           
ServerInvoker(InvokerLocator (src)  locator, java.util.Map configuration)
           
 
Method Summary
 void addInvocationHandler(java.lang.String subsystem, ServerInvocationHandler (src)  handler)
          add a server invocation handler for a particular subsystem.
 void destroy()
          destory the invoker permanently
 java.util.Map getConfiguration()
          Gets teh server invoker's transport specific configuration.
 java.lang.String getDataType()
          Will get the data type for the marshaller factory so know which marshaller to get to marshal the data.
protected abstract  java.lang.String getDefaultDataType()
           
 ServerInvocationHandler (src) getInvocationHandler(java.lang.String subsystem)
          get a ServerInvocationHandler for a given subsystem type
 ServerInvocationHandler (src) [] getInvocationHandlers()
          return an array of the server invocation handlers
abstract  java.lang.String getMBeanObjectName()
          Returns the String for the object name to be used for the invoker.
 MBeanServer (src) getMBeanServer()
           
 java.lang.String[] getSupportedSubsystems()
          return array of keys for each subsystem this invoker can handle
 boolean hasInvocationHandler(java.lang.String subsystem)
          return true if a server invocation handler has been registered for this subsystem
 java.lang.Object invoke(InvocationRequest (src)  invocation)
          Processes invocation request depending on the invocation type (internal, name based, oneway, etc).
 java.lang.Object invoke(java.lang.Object invoke)
           
 boolean isStarted()
          return true if the server invoker is started, false if not
protected  void postProcess(java.lang.String sessionId, java.lang.Object param, java.util.Map payload, InvokerLocator (src)  locator)
          called after an invocation
protected  void preProcess(java.lang.String sessionId, ClassBytes (src)  arg, java.util.Map payload, InvokerLocator (src)  locator)
          called prior to an invocation
 ServerInvocationHandler (src) removeInvocationHandler(java.lang.String subsystem)
          remove a subsystem invocation handler
 void setConfigration(java.util.Map configuration)
          Sets the server invoker's transport specific configuration.
 void setMBeanServer(MBeanServer (src)  server)
           
 void start()
          subclasses should override to provide any specific start logic
 void stop()
          subclasses should override to provide any specific stop logic
 
Methods inherited from class org.jboss.remoting.AbstractInvoker (src)
getClassLoader, getClientLocator, getLocator, setClassLoader, setClientLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.remoting.ServerInvokerMBean (src)
isTransportBiDirectional
 

Field Detail

MAX_NUM_ONEWAY_THREADS

public static final int MAX_NUM_ONEWAY_THREADS
The max number of worker threads to be used in the pool for processing one way calls on the server side. Value is is 100.

See Also:
Constant Field Values (src)

handlers

protected java.util.Map handlers

callbackHandlers

protected java.util.Map callbackHandlers
Constructor Detail

ServerInvoker

public ServerInvoker(InvokerLocator (src)  locator)

ServerInvoker

public ServerInvoker(InvokerLocator (src)  locator,
                     java.util.Map configuration)
Method Detail

getMBeanServer

public MBeanServer (src)  getMBeanServer()

setMBeanServer

public void setMBeanServer(MBeanServer (src)  server)

hasInvocationHandler

public boolean hasInvocationHandler(java.lang.String subsystem)
return true if a server invocation handler has been registered for this subsystem

Parameters:
subsystem -
Returns:

getSupportedSubsystems

public java.lang.String[] getSupportedSubsystems()
return array of keys for each subsystem this invoker can handle

Returns:

getInvocationHandlers

public ServerInvocationHandler (src) [] getInvocationHandlers()
return an array of the server invocation handlers

Returns:

addInvocationHandler

public void addInvocationHandler(java.lang.String subsystem,
                                 ServerInvocationHandler (src)  handler)
add a server invocation handler for a particular subsystem. Typically, subsystems are defined in org.jboss.remoting.Subsystem, however, this can be any string that the caller knows about.

Parameters:
subsystem -
handler -

removeInvocationHandler

public ServerInvocationHandler (src)  removeInvocationHandler(java.lang.String subsystem)
remove a subsystem invocation handler

Parameters:
subsystem -

getInvocationHandler

public ServerInvocationHandler (src)  getInvocationHandler(java.lang.String subsystem)
get a ServerInvocationHandler for a given subsystem type

Parameters:
subsystem -
Returns:

invoke

public java.lang.Object invoke(java.lang.Object invoke)
                        throws java.io.IOException
Throws:
java.io.IOException

getDataType

public java.lang.String getDataType()
Will get the data type for the marshaller factory so know which marshaller to get to marshal the data. Will first check the locator uri for a 'datatype' parameter and take that value if it exists. Otherwise, will use the default datatype for the client invoker, based on transport.

Specified by:
getDataType in interface ServerInvokerMBean (src)
Returns:

getDefaultDataType

protected abstract java.lang.String getDefaultDataType()

invoke

public java.lang.Object invoke(InvocationRequest (src)  invocation)
                        throws java.lang.Throwable
Processes invocation request depending on the invocation type (internal, name based, oneway, etc). Can be called on directly when client and server are local to one another (by-passing serialization)

Parameters:
invocation -
Returns:
Throws:
java.lang.Throwable

preProcess

protected void preProcess(java.lang.String sessionId,
                          ClassBytes (src)  arg,
                          java.util.Map payload,
                          InvokerLocator (src)  locator)
called prior to an invocation

Parameters:
sessionId -
payload -
locator -

postProcess

protected void postProcess(java.lang.String sessionId,
                           java.lang.Object param,
                           java.util.Map payload,
                           InvokerLocator (src)  locator)
called after an invocation

Parameters:
sessionId -
payload -
locator -

start

public void start()
           throws java.io.IOException
subclasses should override to provide any specific start logic

Specified by:
start in interface ServerInvokerMBean (src)
Throws:
java.io.IOException

isStarted

public boolean isStarted()
return true if the server invoker is started, false if not

Specified by:
isStarted in interface ServerInvokerMBean (src)
Returns:

stop

public void stop()
subclasses should override to provide any specific stop logic

Specified by:
stop in interface ServerInvokerMBean (src)

destroy

public void destroy()
destory the invoker permanently

Specified by:
destroy in interface ServerInvokerMBean (src)

setConfigration

public void setConfigration(java.util.Map configuration)
Sets the server invoker's transport specific configuration. Will need to set before calling start() method (or at least stop() and start() again) before configurations will take affect.

Specified by:
setConfigration in interface ServerInvokerMBean (src)
Parameters:
configuration -

getConfiguration

public java.util.Map getConfiguration()
Gets teh server invoker's transport specific configuration.

Specified by:
getConfiguration in interface ServerInvokerMBean (src)
Returns:

getMBeanObjectName

public abstract java.lang.String getMBeanObjectName()
Returns the String for the object name to be used for the invoker.

Returns: