jrunx.rmi
Class RemoteInvocationHandler

java.lang.Object
  |
  +--jrunx.rmi.RemoteInvocationHandler
All Implemented Interfaces:
ClusterConstants, java.io.Externalizable, java.lang.reflect.InvocationHandler, RemoteConstants, java.io.Serializable
Direct Known Subclasses:
ClientInvocationHandlerImpl

public class RemoteInvocationHandler
extends java.lang.Object
implements RemoteConstants, java.lang.reflect.InvocationHandler, java.io.Externalizable

The client-side class that creates invocations to be sent to the remote RMIBroker. It is configured with a list of stubs to remote servers, and this list is used as the "starter" stubs for invocations. When an Invocation is created, it uses these stubs in conjunction with a ClusterAlgorithm to locate and invoke itself on a remote server. The invocation itself is passed across the wire and returned to this handler with updated stubs, so that the handler can receive callback information about the failure and addition of new services in the cluster in which it is interested.
The EJB server's ClientInvocationHandlerImpl extends this class, and this class is used directly by the remote JNDI and remote Service invocation subsystems.

Author:
PS Neville
See Also:
Serialized Form

Field Summary
protected  ClusterAlgorithm clusterAlgorithm
           
protected  java.util.ArrayList initialServers
           
protected  java.lang.String invocationClass
           
protected  boolean rmiMarshalling
           
protected  java.lang.String subsystem
           
protected  int system
           
 
Fields inherited from interface jrunx.rmi.RemoteConstants
EJB, EJB_CONTAINER, JDBC, JMS, SERVICE
 
Fields inherited from interface jrunx.cluster.ClusterConstants
AVAILABLE_SERVICES, CLUSTER_MANAGER_JNDI, DEFAULT_CLUSTER_DOMAIN, DEFAULT_ENABLED, JINI_CODE_BASE_JAR, PRIMARY_SERVICE, SECONDARY_SERVICE
 
Constructor Summary
RemoteInvocationHandler()
           
RemoteInvocationHandler(ClusterableServiceAdapter svc)
           
 
Method Summary
 void addAvailableServer(ClusterableService svc)
           
 java.util.ArrayList getAvailableServers()
           
 ClusterAlgorithm getClusterAlgorithm()
           
protected  Invocation getInvocation(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Get or create the Invocation object to encapsulate the method invocation.
 java.lang.String getSubsystem()
           
 int getSystem()
           
protected  java.lang.Object invoke(Invocation inv)
          Get the appropriate server stub for the operation and invoke the operation, which may transform the Invocation with event info (cluster callbacks).
 java.lang.Object invoke(java.lang.Object o, java.lang.reflect.Method method, java.lang.Object[] objects)
           
protected  boolean matchesStubType(java.util.ArrayList stubs)
           
 void readExternal(java.io.ObjectInput in)
           
 void setAvailableServers(java.util.ArrayList availableServers)
           
 void setClusterAlgorithm(ClusterAlgorithm clusterAlgorithm)
           
 void setRmiMarshalling(boolean rmiMarshalling)
           
 void setSubsystem(java.lang.String subsystem)
           
 void setSystem(int system)
           
protected  java.util.ArrayList toStubs(java.util.ArrayList services)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rmiMarshalling

protected boolean rmiMarshalling

system

protected int system

subsystem

protected java.lang.String subsystem

initialServers

protected java.util.ArrayList initialServers

clusterAlgorithm

protected ClusterAlgorithm clusterAlgorithm

invocationClass

protected java.lang.String invocationClass
Constructor Detail

RemoteInvocationHandler

public RemoteInvocationHandler()

RemoteInvocationHandler

public RemoteInvocationHandler(ClusterableServiceAdapter svc)
Method Detail

setRmiMarshalling

public void setRmiMarshalling(boolean rmiMarshalling)

getClusterAlgorithm

public ClusterAlgorithm getClusterAlgorithm()

setClusterAlgorithm

public void setClusterAlgorithm(ClusterAlgorithm clusterAlgorithm)

getSystem

public int getSystem()

setSystem

public void setSystem(int system)

getSubsystem

public java.lang.String getSubsystem()

setSubsystem

public void setSubsystem(java.lang.String subsystem)

getAvailableServers

public java.util.ArrayList getAvailableServers()

setAvailableServers

public void setAvailableServers(java.util.ArrayList availableServers)

addAvailableServer

public void addAvailableServer(ClusterableService svc)

invoke

public java.lang.Object invoke(java.lang.Object o,
                               java.lang.reflect.Method method,
                               java.lang.Object[] objects)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler

invoke

protected java.lang.Object invoke(Invocation inv)
                           throws java.lang.Throwable
Get the appropriate server stub for the operation and invoke the operation, which may transform the Invocation with event info (cluster callbacks). If a RemoteException occurs, the method will be invoked on another stub, if possible. This will cause a RemoteException if there are no more valid stubs for the algorithm to use, which will be propagated to the caller. Other applications will be propagated without reinvoking on other stubs.

matchesStubType

protected boolean matchesStubType(java.util.ArrayList stubs)

getInvocation

protected Invocation getInvocation(java.lang.Object proxy,
                                   java.lang.reflect.Method method,
                                   java.lang.Object[] args)
                            throws java.lang.Exception
Get or create the Invocation object to encapsulate the method invocation.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable

toStubs

protected java.util.ArrayList toStubs(java.util.ArrayList services)


Copyright � 2002 Macromedia Corporation. All Rights Reserved.