jrunx.cluster
Class StatefulBuddyAlgorithm
java.lang.Object
|
+--jrunx.cluster.ClusterAlgorithm
|
+--jrunx.cluster.AbstractBuddyAlgorithm
|
+--jrunx.cluster.StatefulBuddyAlgorithm
- All Implemented Interfaces:
- ClusterConstants, java.io.Serializable
- public class StatefulBuddyAlgorithm
- extends AbstractBuddyAlgorithm
- implements java.io.Serializable
This algorithm treats one ClusterableService as the primary service,
and invokes all methods on it. It also maintains a secondary stub, which
will become the primary in the event of a primary RemoteException on the
original primary.
Stateful session EJBObjects make use of this algorithm in conjunction
with a container interceptor that ensures instance information is transferred
from the primary to the secondary upon every method invocation. If the secondary
has become the primary, then the interceptor also chooses a new secondary, if possible.
The interceptor must choose the secondary because only it can transfer enough the state
information.
A new instance is NOT created in the secondary container, ever. Should the
secondary become the primary, then the interceptor creates a new instance for that new
primary based on the stored instance state snapshot it has received.
If the instance is involved in a transaction when it passes through the interceptor,
the transfer of state does NOT occur. In this case, failing over to a secondary will
be similar to suffering a rollback, in that any uncommitted changes to a primary
instance will not be available.
- Author:
- Enrique Duvos
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatefulBuddyAlgorithm
public StatefulBuddyAlgorithm(java.lang.String subSystem,
boolean rmiMarshalling,
ClusterableService primary,
java.util.ArrayList services)
isRmiMarshalling
public boolean isRmiMarshalling()
setRmiMarshalling
public void setRmiMarshalling(boolean rmiMarshalling)
getSubSystem
public java.lang.String getSubSystem()
setSubSystem
public void setSubSystem(java.lang.String subSystem)
getBuddy
public ClusterableService getBuddy(java.util.ArrayList services,
ClusterableService primary)
- Overrides:
getBuddy in class AbstractBuddyAlgorithm
Copyright � 2002 Macromedia Corporation. All Rights Reserved.