Class SimpleSingletonElectionPolicy
- java.lang.Object
-
- org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy
-
- All Implemented Interfaces:
SingletonElectionPolicy
public class SimpleSingletonElectionPolicy extends Object implements SingletonElectionPolicy
A simple concrete policy service that decides which node in the cluster should be the primary 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 behavior can be achieved with this policy when "position" is set to 0.- Author:
- Alex Fu, Galder Zamarreno, Paul Ferraro
-
-
Constructor Summary
Constructors Constructor Description SimpleSingletonElectionPolicy()SimpleSingletonElectionPolicy(int position)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Nodeelect(List<Node> candidates)Elect a single node from the specified list of candidate nodes.
-
-
-
Method Detail
-
elect
public Node elect(List<Node> candidates)
Description copied from interface:SingletonElectionPolicyElect a single node from the specified list of candidate nodes.- Specified by:
electin interfaceSingletonElectionPolicy- Parameters:
candidates- a list of candidate nodes.- Returns:
- the elected node
-
-