|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.ha.framework.server.DistributedReplicantManagerImpl
This class manages replicated objects.
Nested Class Summary | |
protected class |
DistributedReplicantManagerImpl.MembersPublisher
|
protected class |
DistributedReplicantManagerImpl.MergeMembers
|
Nested classes inherited from class org.jboss.ha.framework.interfaces.DistributedReplicantManager |
DistributedReplicantManager.ReplicantListener |
Field Summary | |
protected Class[] |
add_types
|
protected HashMap |
intraviewIdCache
|
protected javax.management.ObjectName |
jmxName
|
protected HashMap |
keyListeners
|
protected HashMap |
localReplicants
|
protected org.jboss.logging.Logger |
log
|
protected javax.management.MBeanServer |
mbeanserver
|
protected String |
nodeName
|
protected HAPartition |
partition
|
protected EDU.oswego.cs.dl.util.concurrent.Latch |
partitionNameKnown
|
protected Class[] |
remove_types
|
protected HashMap |
replicants
|
protected static String |
SERVICE_NAME
|
protected static int |
threadID
|
protected boolean |
trace
|
Constructor Summary | |
DistributedReplicantManagerImpl(HAPartition partition,
javax.management.MBeanServer server)
This class manages replicated objects through the given partition |
Method Summary | |
void |
_add(String key,
String nodeName,
Serializable replicant)
cluster callback called when a new replicant is added on another node |
void |
_remove(String key,
String nodeName)
cluster callback called when a replicant is removed by another node |
void |
add(String key,
Serializable replicant)
Add a replicant, it will be attached to this cluster node |
protected void |
addReplicant(HashMap map,
String key,
String nodeName,
Serializable replicant)
Logic for adding replicant to any map. |
protected void |
addReplicant(String key,
String nodeName,
Serializable replicant)
Add a replicant to the replicants map. |
protected int |
calculateReplicantsHash(List members)
|
protected void |
cleanupKeyListeners()
|
Collection |
getAllServices()
Return a list of all services that have a least one replicant. |
Serializable |
getCurrentState()
Called when a new node need to be initialized. |
protected Vector |
getKeysReplicatedByNode(String nodeName)
|
int |
getReplicantsViewId(String key)
Returns an id corresponding to the current view of this set of replicants. |
void |
init()
|
boolean |
isMasterReplica(String key)
Indicates if the current node is the master replica for this given key. |
String |
listContent()
|
String |
listXmlContent()
|
Serializable |
lookupLocalReplicant(String key)
Lookup the replicant attached to this cluster node |
Object[] |
lookupLocalReplicants()
Cluster callback called when a node wants to know our complete list of local replicants |
List |
lookupReplicants(String key)
Return a list of all replicants. |
List |
lookupReplicantsNodeNames(String key)
Return a list of all replicants node names. |
void |
membershipChanged(Vector deadMembers,
Vector newMembers,
Vector allMembers)
Called when a new partition topology occurs. |
void |
membershipChangedDuringMerge(Vector deadMembers,
Vector newMembers,
Vector allMembers,
Vector originatingGroups)
Extends HAMembershipListener to receive a specific callback when a network-partition merge occurs. |
protected void |
mergeMembers()
|
protected static int |
nextThreadID()
|
protected void |
notifyKeyListeners(String key,
List newReplicants)
Notifies, through a callback, the listeners for a given replicant that the set of replicants has changed |
protected void |
purgeDeadMembers(Vector deadMembers)
get rid of dead members from replicant list return true if anything was purged. |
void |
registerListener(String key,
DistributedReplicantManager.ReplicantListener subscriber)
Subscribe a new listener ReplicantListener for replicants change |
void |
remove(String key)
Remove the entire key from the ReplicationService |
protected boolean |
removeReplicant(String key,
String nodeName)
|
protected boolean |
replicantEntryAlreadyExists(HashMap map,
String key,
String nodeName)
Indicates if the a replicant already exists for a given key/node pair in the give data structure |
protected boolean |
replicantEntryAlreadyExists(String key,
String nodeName)
Indicates if the a replicant already exists for a given key/node pair |
protected void |
republishLocalReplicants()
|
void |
setCurrentState(Serializable newState)
This callback method is called when a new service starts on a new node: the state that it should hold is transfered to it through this callback |
void |
start()
|
void |
stop()
|
void |
unregisterListener(String key,
DistributedReplicantManager.ReplicantListener subscriber)
Unsubscribe a listener ReplicantListener that had subscribed for replicants changes |
protected int |
updateReplicantsHashId(String key)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final String SERVICE_NAME
protected static int threadID
protected HashMap localReplicants
protected HashMap replicants
protected HashMap keyListeners
protected HashMap intraviewIdCache
protected HAPartition partition
protected org.jboss.logging.Logger log
protected javax.management.MBeanServer mbeanserver
protected javax.management.ObjectName jmxName
protected String nodeName
protected EDU.oswego.cs.dl.util.concurrent.Latch partitionNameKnown
protected boolean trace
protected Class[] add_types
protected Class[] remove_types
Constructor Detail |
public DistributedReplicantManagerImpl(HAPartition partition, javax.management.MBeanServer server)
partition
- HAPartition
through which replicated objects will be exchangedMethod Detail |
public void init() throws Exception
Exception
public void start() throws Exception
Exception
public void stop() throws Exception
Exception
public String listContent() throws Exception
listContent
in interface DistributedReplicantManagerImplMBean
Exception
public String listXmlContent() throws Exception
listXmlContent
in interface DistributedReplicantManagerImplMBean
Exception
public Serializable getCurrentState()
HAPartition.HAPartitionStateTransfer
getCurrentState
in interface HAPartition.HAPartitionStateTransfer
public void setCurrentState(Serializable newState)
HAPartition.HAPartitionStateTransfer
setCurrentState
in interface HAPartition.HAPartitionStateTransfer
newState
- The serialized representation of the state of the new service.public Collection getAllServices()
DistributedReplicantManager
getAllServices
in interface DistributedReplicantManager
public void membershipChangedDuringMerge(Vector deadMembers, Vector newMembers, Vector allMembers, Vector originatingGroups)
HAPartition.HAMembershipExtendedListener
membershipChangedDuringMerge
in interface HAPartition.HAMembershipExtendedListener
deadMembers
- A list of nodes that have died since the previous viewnewMembers
- A list of nodes that have joined the partition since the previous viewallMembers
- A list of nodes that built the current vieworiginatingGroups
- A list of list of nodes that were previously partionned and that are now mergedpublic void membershipChanged(Vector deadMembers, Vector newMembers, Vector allMembers)
HAPartition.HAMembershipListener
membershipChanged
in interface HAPartition.HAMembershipListener
deadMembers
- A list of nodes that have died since the previous viewnewMembers
- A list of nodes that have joined the partition since the previous viewallMembers
- A list of nodes that built the current viewpublic void add(String key, Serializable replicant) throws Exception
DistributedReplicantManager
add
in interface DistributedReplicantManager
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
Exception
- Thrown if a cluster communication problem occurspublic void remove(String key) throws Exception
DistributedReplicantManager
remove
in interface DistributedReplicantManager
key
- Name of the replicant
Exception
- Thrown if a cluster communication problem occurspublic Serializable lookupLocalReplicant(String key)
DistributedReplicantManager
lookupLocalReplicant
in interface DistributedReplicantManager
key
- The name of the replicant
public List lookupReplicants(String key)
DistributedReplicantManager
lookupReplicants
in interface DistributedReplicantManager
key
- The replicant name
public List lookupReplicantsNodeNames(String key)
DistributedReplicantManager
lookupReplicantsNodeNames
in interface DistributedReplicantManager
key
- The replicant name
public void registerListener(String key, DistributedReplicantManager.ReplicantListener subscriber)
DistributedReplicantManager
DistributedReplicantManager.ReplicantListener
for replicants change
registerListener
in interface DistributedReplicantManager
key
- Name of the replicant, must be identical cluster-wide for all identical replicantssubscriber
- The subsribing DistributedReplicantManager.ReplicantListener
public void unregisterListener(String key, DistributedReplicantManager.ReplicantListener subscriber)
DistributedReplicantManager
DistributedReplicantManager.ReplicantListener
that had subscribed for replicants changes
unregisterListener
in interface DistributedReplicantManager
key
- Name of the replicant, must be identical cluster-wide for all identical replicantssubscriber
- The unsubscribing DistributedReplicantManager.ReplicantListener
public int getReplicantsViewId(String key)
DistributedReplicantManager
getReplicantsViewId
in interface DistributedReplicantManager
key
- The replicant name
public boolean isMasterReplica(String key)
DistributedReplicantManager
isMasterReplica
in interface DistributedReplicantManager
key
- The replicant name
public void _add(String key, String nodeName, Serializable replicant)
key
- Replicant keynodeName
- Node that add the current replicantreplicant
- Serialized representation of the replicantpublic void _remove(String key, String nodeName)
key
- Name of the replicant keynodeName
- Node that wants to remove its replicant for the give keyprotected boolean removeReplicant(String key, String nodeName) throws Exception
Exception
public Object[] lookupLocalReplicants() throws Exception
Exception
- Thrown if a cluster communication exception occursprotected int calculateReplicantsHash(List members)
protected int updateReplicantsHashId(String key)
protected void addReplicant(String key, String nodeName, Serializable replicant)
key
- replicant key namenodeName
- name of the node that adds this replicantreplicant
- Serialized representation of the replicaprotected void addReplicant(HashMap map, String key, String nodeName, Serializable replicant)
map
- structure in which adding the new replicantkey
- name of the replicant keynodeName
- name of the node adding the replicantreplicant
- serialized representation of the replicant that is addedprotected Vector getKeysReplicatedByNode(String nodeName)
protected boolean replicantEntryAlreadyExists(String key, String nodeName)
key
- replicant key namenodeName
- name of the node
protected boolean replicantEntryAlreadyExists(HashMap map, String key, String nodeName)
protected void notifyKeyListeners(String key, List newReplicants)
key
- The replicant key namenewReplicants
- The new list of replicantsprotected void republishLocalReplicants()
protected void mergeMembers()
protected void purgeDeadMembers(Vector deadMembers)
protected void cleanupKeyListeners()
protected static int nextThreadID()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |