jrunx.cluster
Class BuddyAlgorithm
java.lang.Object
|
+--jrunx.cluster.ClusterAlgorithm
|
+--jrunx.cluster.AbstractBuddyAlgorithm
|
+--jrunx.cluster.BuddyAlgorithm
- All Implemented Interfaces:
- ClusterConstants, java.io.Serializable
- public class BuddyAlgorithm
- 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:
- PS Neville
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
primary
public ClusterableService primary
secondary
public ClusterableService secondary
BuddyAlgorithm
public BuddyAlgorithm()
BuddyAlgorithm
public BuddyAlgorithm(java.util.ArrayList services)
BuddyAlgorithm
public BuddyAlgorithm(ClusterableService primary,
java.util.ArrayList services)
getBuddy
public ClusterableService getBuddy(java.util.ArrayList services,
ClusterableService primary)
- Overrides:
getBuddy in class AbstractBuddyAlgorithm
Copyright � 2002 Macromedia Corporation. All Rights Reserved.