org.jboss.ha.framework.interfaces
Interface DistributedReplicantManager

All Known Subinterfaces:
DistributedReplicantManagerImplMBean (src)
All Known Implementing Classes:
DistributedReplicantManagerImpl (src)

public interface DistributedReplicantManager


Nested Class Summary
static interface DistributedReplicantManager.ReplicantListener (src)
          When a particular key in the DistributedReplicantManager table gets modified, all listeners will be notified of replicant changes for that key.
 
Method Summary
 void add(java.lang.String key, java.io.Serializable replicant)
          Add a replicant, it will be attached to this cluster node
 java.util.Collection getAllServices()
          Return a list of all services that have a least one replicant.
 int getReplicantsViewId(java.lang.String key)
          Returns an id corresponding to the current view of this set of replicants.
 boolean isMasterReplica(java.lang.String key)
          Indicates if the current node is the master replica for this given key.
 java.io.Serializable lookupLocalReplicant(java.lang.String key)
          Lookup the replicant attached to this cluster node
 java.util.List lookupReplicants(java.lang.String key)
          Return a list of all replicants.
 java.util.List lookupReplicantsNodeNames(java.lang.String key)
          Return a list of all replicants node names.
 void registerListener(java.lang.String key, DistributedReplicantManager.ReplicantListener (src)  subscriber)
          Subscribe a new listener DistributedReplicantManager.ReplicantListener (src) for replicants change
 void remove(java.lang.String key)
          Remove the entire key from the ReplicationService
 void unregisterListener(java.lang.String key, DistributedReplicantManager.ReplicantListener (src)  subscriber)
          Unsubscribe a listener DistributedReplicantManager.ReplicantListener (src) that had subscribed for replicants changes
 

Method Detail

registerListener

public void registerListener(java.lang.String key,
                             DistributedReplicantManager.ReplicantListener (src)  subscriber)
Subscribe a new listener DistributedReplicantManager.ReplicantListener (src) for replicants change

Parameters:
key - Name of the replicant, must be identical cluster-wide for all identical replicants
subscriber - The subsribing DistributedReplicantManager.ReplicantListener (src)

unregisterListener

public void unregisterListener(java.lang.String key,
                               DistributedReplicantManager.ReplicantListener (src)  subscriber)
Unsubscribe a listener DistributedReplicantManager.ReplicantListener (src) that had subscribed for replicants changes

Parameters:
key - Name of the replicant, must be identical cluster-wide for all identical replicants
subscriber - The unsubscribing DistributedReplicantManager.ReplicantListener (src)

add

public void add(java.lang.String key,
                java.io.Serializable replicant)
         throws java.lang.Exception
Add a replicant, it will be attached to this cluster node

Parameters:
key - Replicant name. All replicas around the cluster must use the same key name.
replicant - Local data of the replicant, that is, any serializable data
Throws:
java.lang.Exception - Thrown if a cluster communication problem occurs

remove

public void remove(java.lang.String key)
            throws java.lang.Exception
Remove the entire key from the ReplicationService

Parameters:
key - Name of the replicant
Throws:
java.lang.Exception - Thrown if a cluster communication problem occurs

lookupLocalReplicant

public java.io.Serializable lookupLocalReplicant(java.lang.String key)
Lookup the replicant attached to this cluster node

Parameters:
key - The name of the replicant
Returns:
The local replicant for the give key name

lookupReplicants

public java.util.List lookupReplicants(java.lang.String key)
Return a list of all replicants.

Parameters:
key - The replicant name
Returns:
An array of serialized replicants available around the cluster for the given key

lookupReplicantsNodeNames

public java.util.List lookupReplicantsNodeNames(java.lang.String key)
Return a list of all replicants node names.

Parameters:
key - The replicant name
Returns:
An array of replicants node names available around the cluster for the given key

getAllServices

public java.util.Collection getAllServices()
Return a list of all services that have a least one replicant.

Returns:
A collection of services names (String)

getReplicantsViewId

public int getReplicantsViewId(java.lang.String key)
Returns an id corresponding to the current view of this set of replicants.

Parameters:
key - The replicant name
Returns:
A view id (doesn't grow sequentially)

isMasterReplica

public boolean isMasterReplica(java.lang.String key)
Indicates if the current node is the master replica for this given key.

Parameters:
key - The replicant name
Returns:
True if this node is the master