org.jboss.ha.singleton
Class HASingletonElectionPolicySimple
java.lang.Object
org.jboss.ha.singleton.HASingletonElectionPolicySimple
- All Implemented Interfaces:
- org.jboss.ha.framework.interfaces.HASingletonElectionPolicy, HASingletonElectionPolicySimpleMBean
- Direct Known Subclasses:
- PreferredMasterElectionPolicy
public class HASingletonElectionPolicySimple
- extends Object
- implements org.jboss.ha.framework.interfaces.HASingletonElectionPolicy, HASingletonElectionPolicySimpleMBean
A simple concrete policy service that decides which node in the cluster should be
the master node to run certain HASingleton service based on attribute "Position".
The value will be divided by partition size and only remainder will be used.
Let's say partition size is n:
0 means the first oldest node.
1 means the 2nd oldest node.
...
n-1 means the nth oldest node.
-1 means the youngest node.
-2 means the 2nd youngest node.
...
-n means the nth youngest node.
E.g. the following attribute says the singleton will be running on the 3rd oldest node of
the current partition:
2
If no election policy is defined, the oldest node in the cluster runs the
singleton. This behaivour can be achieved with this policy when "position"
is set to 0.
- Version:
- $Revision: 81001 $
- Author:
- Alex Fu, Galder Zamarreno
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HASingletonElectionPolicySimple
public HASingletonElectionPolicySimple()
setPosition
public void setPosition(int pos)
- Description copied from interface:
HASingletonElectionPolicySimpleMBean
- Attribute: position.
0 means the oldest node, 1 means 2nd oldest, ...
-1 means the youngest node, -2 means 2nd youngest, ...
- Specified by:
setPosition
in interface HASingletonElectionPolicySimpleMBean
- See Also:
HASingletonElectionPolicySimpleMBean.setPosition(int)
getPosition
public int getPosition()
- Specified by:
getPosition
in interface HASingletonElectionPolicySimpleMBean
- See Also:
HASingletonElectionPolicySimpleMBean.getPosition()
elect
public org.jboss.ha.framework.interfaces.ClusterNode elect(List<org.jboss.ha.framework.interfaces.ClusterNode> candidates)
- Specified by:
elect
in interface org.jboss.ha.framework.interfaces.HASingletonElectionPolicy
Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.