org.jboss.remoting
Class ServerInvoker

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

public abstract class ServerInvoker
extends AbstractInvoker
implements ServerInvokerMBean

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.

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

Field Summary
protected  Map callbackHandlers
           
protected  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
classbyteloader, localServerLocator, locator, log
 
Constructor Summary
ServerInvoker(InvokerLocator locator)
           
ServerInvoker(InvokerLocator locator, Map configuration)
           
 
Method Summary
 ServerInvocationHandler addInvocationHandler(String subsystem, ServerInvocationHandler handler)
          add a server invocation handler for a particular subsystem.
 void destroy()
          destory the invoker permanently
 Map getConfiguration()
          Gets teh server invoker's transport specific configuration.
 String getDataType()
          Will get the data type for the marshaller factory so know which marshaller to get to marshal the data.
protected abstract  String getDefaultDataType()
           
 ServerInvocationHandler getInvocationHandler(String subsystem)
          get a ServerInvocationHandler for a given subsystem type
 ServerInvocationHandler[] getInvocationHandlers()
          return an array of the server invocation handlers
 String getMBeanObjectName()
          Returns the String for the object name to be used for the invoker.
 javax.management.MBeanServer getMBeanServer()
           
 String[] getSupportedSubsystems()
          return array of keys for each subsystem this invoker can handle
 boolean hasInvocationHandler(String subsystem)
          return true if a server invocation handler has been registered for this subsystem
 Object invoke(InvocationRequest invocation)
          Processes invocation request depending on the invocation type (internal, name based, oneway, etc).
 Object invoke(Object invoke)
           
 boolean isStarted()
          return true if the server invoker is started, false if not
protected  void postProcess(String sessionId, Object param, Map payload, InvokerLocator locator)
          called after an invocation
protected  void preProcess(String sessionId, ClassBytes arg, Map payload, InvokerLocator locator)
          called prior to an invocation
 ServerInvocationHandler removeInvocationHandler(String subsystem)
          remove a subsystem invocation handler
 void setConfigration(Map configuration)
          Sets the server invoker's transport specific configuration.
 void setMBeanServer(javax.management.MBeanServer 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
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
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

handlers

protected Map handlers

callbackHandlers

protected Map callbackHandlers
Constructor Detail

ServerInvoker

public ServerInvoker(InvokerLocator locator)

ServerInvoker

public ServerInvoker(InvokerLocator locator,
                     Map configuration)
Method Detail

getMBeanServer

public javax.management.MBeanServer getMBeanServer()

setMBeanServer

public void setMBeanServer(javax.management.MBeanServer server)

hasInvocationHandler

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

Parameters:
subsystem -
Returns:

getSupportedSubsystems

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

Returns:

getInvocationHandlers

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

Returns:

addInvocationHandler

public ServerInvocationHandler addInvocationHandler(String subsystem,
                                                    ServerInvocationHandler 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 -
Returns:
previous ServerInvocationHandler with the same sybsystem value (case insensitive) or null if a previous one did not exist.

removeInvocationHandler

public ServerInvocationHandler removeInvocationHandler(String subsystem)
remove a subsystem invocation handler

Parameters:
subsystem -

getInvocationHandler

public ServerInvocationHandler getInvocationHandler(String subsystem)
get a ServerInvocationHandler for a given subsystem type

Parameters:
subsystem -
Returns:

invoke

public Object invoke(Object invoke)
              throws IOException
Throws:
IOException

getDataType

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

getDefaultDataType

protected abstract String getDefaultDataType()

invoke

public Object invoke(InvocationRequest invocation)
              throws 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:
Throwable

preProcess

protected void preProcess(String sessionId,
                          ClassBytes arg,
                          Map payload,
                          InvokerLocator locator)
called prior to an invocation

Parameters:
sessionId -
payload -
locator -

postProcess

protected void postProcess(String sessionId,
                           Object param,
                           Map payload,
                           InvokerLocator locator)
called after an invocation

Parameters:
sessionId -
payload -
locator -

start

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

Specified by:
start in interface ServerInvokerMBean
Throws:
IOException

isStarted

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

Specified by:
isStarted in interface ServerInvokerMBean
Returns:

stop

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

Specified by:
stop in interface ServerInvokerMBean

destroy

public void destroy()
destory the invoker permanently

Specified by:
destroy in interface ServerInvokerMBean

setConfigration

public void setConfigration(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
Parameters:
configuration -

getConfiguration

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

Specified by:
getConfiguration in interface ServerInvokerMBean
Returns:

getMBeanObjectName

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

Returns:


Copyright © 2004 JBoss Inc. All Rights Reserved.