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