public final class QuorumManager extends Object implements ClusterTopologyListener, ActiveMQComponent
Constructor and Description |
---|
QuorumManager(ExecutorService threadPool,
ClusterController clusterController) |
Modifier and Type | Method and Description |
---|---|
int |
getMaxClusterSize()
returns the maximum size this cluster has been.
|
QuorumVoteHandler |
getVoteHandler(SimpleString handler) |
boolean |
isStarted()
are we started
|
void |
nodeDown(long eventUID,
String nodeID)
notify the
Quorum of a topology change. |
void |
nodeUP(TopologyMember topologyMember,
boolean last)
called by the
ServerLocatorInternal when the topology changes. |
void |
registerQuorum(Quorum quorum)
registers a
Quorum so that it can be notified of changes in the cluster. |
void |
registerQuorumHandler(QuorumVoteHandler quorumVoteHandler)
called to register vote handlers on the quorum
|
void |
start()
we start by simply creating the server locator and connecting in a separate thread
|
void |
stop()
stops the server locator
|
String |
toString() |
void |
unRegisterQuorum(Quorum quorum)
unregisters a
Quorum . |
void |
vote(QuorumVote quorumVote)
ask the quorum to vote within a specific quorum.
|
Vote |
vote(SimpleString handler,
Vote vote)
handle a vote received on the quorum
|
void |
voteComplete(QuorumVoteServerConnect quorumVote)
must be called by the quorum when it is happy on an outcome.
|
public QuorumManager(ExecutorService threadPool, ClusterController clusterController)
public void start() throws Exception
start
in interface ActiveMQComponent
Exception
public void stop() throws Exception
stop
in interface ActiveMQComponent
Exception
public boolean isStarted()
isStarted
in interface ActiveMQComponent
public void registerQuorum(Quorum quorum)
Quorum
so that it can be notified of changes in the cluster.quorum
- public void unRegisterQuorum(Quorum quorum)
Quorum
.quorum
- public void nodeUP(TopologyMember topologyMember, boolean last)
ServerLocatorInternal
when the topology changes. we update the
maxClusterSize
if needed and inform the Quorum
's.nodeUP
in interface ClusterTopologyListener
topologyMember
- the topolgy changedlast
- if the whole cluster topology is being transmitted (after adding the listener to
the cluster connection) this parameter will be true
for the last topologypublic void nodeDown(long eventUID, String nodeID)
Quorum
of a topology change.nodeDown
in interface ClusterTopologyListener
eventUID
- nodeID
- the id of the node leaving the clusterpublic int getMaxClusterSize()
public void vote(QuorumVote quorumVote)
quorumVote
- the vote to acquirepublic Vote vote(SimpleString handler, Vote vote)
handler
- the name of the handler to use for the votevote
- the votepublic void voteComplete(QuorumVoteServerConnect quorumVote)
quorumVote
- the votepublic void registerQuorumHandler(QuorumVoteHandler quorumVoteHandler)
quorumVoteHandler
- the vote handlerpublic QuorumVoteHandler getVoteHandler(SimpleString handler)
Copyright © 2017 JBoss by Red Hat. All rights reserved.