org.jboss.remoting
Class ServerInvoker

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

public abstract class ServerInvoker
extends AbstractInvoker

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

Field Summary
protected  Map callbackHandlers
           
protected  Map handlers
           
static int MAX_NUM_ONEWAY_THREADS
          Indicated the max number of threads used within oneway thread pool.
 
Fields inherited from class org.jboss.remoting.AbstractInvoker
classbyteloader, localServerLocator, locator, log, logExtra
 
Constructor Summary
ServerInvoker(InvokerLocator locator)
           
 
Method Summary
 void addInvocationHandler(String subsystem, ServerInvocationHandler handler)
          add a server invocation handler for a particular subsystem.
 ServerInvocationHandler getInvocationHandler(String subsystem)
          get a ServerInvocationHandler for a given subsystem type
 ServerInvocationHandler[] getInvocationHandlers()
          return an array of the server invocation handlers
 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
 byte[] invoke(byte[] buf)
          called by the transport to handle unmarshalling, invocation, and re-marshalling the result back to the client
 Object invoke(InvocationRequest invocation)
          Processes invocation request depending on the invocation type (internal, name based, oneway, etc).
 boolean isStarted()
          return true if the server invoker is started, false if not
abstract  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 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 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
addClass, getClassBytes, getClientLocator, getLocator, loadClass, read, setClassLoader, setClientLocator, unmarshal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NUM_ONEWAY_THREADS

public static final int MAX_NUM_ONEWAY_THREADS
Indicated the max number of threads used within oneway thread pool.

See Also:
Constant Field Values

handlers

protected Map handlers

callbackHandlers

protected Map callbackHandlers
Constructor Detail

ServerInvoker

public ServerInvoker(InvokerLocator locator)
Method Detail

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 void 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 -

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 byte[] invoke(byte[] buf)
              throws IOException
called by the transport to handle unmarshalling, invocation, and re-marshalling the result back to the client

Parameters:
buf -
Returns:
Throws:
IOException

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

isTransportBiDirectional

public abstract 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).

Returns:

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

Throws:
IOException

isStarted

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

Returns:

stop

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



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.