org.jboss.ha.framework.interfaces
Interface DistributedReplicantManager

All Known Subinterfaces:
DistributedReplicantManagerImplMBean
All Known Implementing Classes:
DistributedReplicantManagerImpl

public interface DistributedReplicantManager

Version:
$Revision: 1.9.6.2 $

Revisions:

2001/10/31: marcf

  1. DRM is no longer remote

2002/08/23: Sacha Labourey

  1. added isMasterReplica
Author:
Bill Burke., Sacha Labourey.

Nested Class Summary
static interface DistributedReplicantManager.ReplicantListener
          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(String key, Serializable replicant)
          Add a replicant, it will be attached to this cluster node
 Collection getAllServices()
          Return a list of all services that have a least one replicant.
 int getReplicantsViewId(String key)
          Returns an id corresponding to the current view of this set of replicants.
 boolean isMasterReplica(String key)
          Indicates if the current node is the master replica for this given key.
 Serializable lookupLocalReplicant(String key)
          Lookup the replicant attached to this cluster node
 List lookupReplicants(String key)
          Return a list of all replicants.
 List lookupReplicantsNodeNames(String key)
          Return a list of all replicants node names.
 void registerListener(String key, DistributedReplicantManager.ReplicantListener subscriber)
          Subscribe a new listener DistributedReplicantManager.ReplicantListener for replicants change
 void remove(String key)
          Remove the entire key from the ReplicationService
 void unregisterListener(String key, DistributedReplicantManager.ReplicantListener subscriber)
          Unsubscribe a listener DistributedReplicantManager.ReplicantListener that had subscribed for replicants changes
 

Method Detail

registerListener

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

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

unregisterListener

void unregisterListener(String key,
                        DistributedReplicantManager.ReplicantListener subscriber)
Unsubscribe a listener DistributedReplicantManager.ReplicantListener 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

add

void add(String key,
         Serializable replicant)
         throws 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:
Exception - Thrown if a cluster communication problem occurs

remove

void remove(String key)
            throws Exception
Remove the entire key from the ReplicationService

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

lookupLocalReplicant

Serializable lookupLocalReplicant(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

List lookupReplicants(String key)
Return a list of all replicants.

Parameters:
key - The replicant name
Returns:
An list of serialized replicants available around the cluster for the given key. This list will be in the same order in all nodes in the cluster.

lookupReplicantsNodeNames

List lookupReplicantsNodeNames(String key)
Return a list of all replicants node names.

Parameters:
key - The replicant name
Returns:
A list the node names of cluster nodes that have made available a replicant for the given key. This list will be in the same order in all nodes in the cluster.

getAllServices

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

Returns:
A collection of services names (String)

getReplicantsViewId

int getReplicantsViewId(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

boolean isMasterReplica(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


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