org.jboss.ha.singleton
Class PreferredMasterElectionPolicy

java.lang.Object
  extended by org.jboss.ha.singleton.HASingletonElectionPolicySimple
      extended by org.jboss.ha.singleton.PreferredMasterElectionPolicy
All Implemented Interfaces:
org.jboss.ha.framework.interfaces.HASingletonElectionPolicy, HASingletonElectionPolicySimpleMBean, PreferredMasterElectionPolicyMBean

public class PreferredMasterElectionPolicy
extends HASingletonElectionPolicySimple
implements PreferredMasterElectionPolicyMBean

Election policy that chooses the node where the singleton should run based on the given preferred master node in ip_address:port_number or host_name:port_number format. If the preferred master is null, or its ip_address does not resolve to a valid host name, or the port number is invalid, it delegates to the standard policy.

Author:
Galder Zamarreno, Paul Ferraro

Constructor Summary
PreferredMasterElectionPolicy()
           
 
Method Summary
 org.jboss.ha.framework.interfaces.ClusterNode elect(List<org.jboss.ha.framework.interfaces.ClusterNode> candidates)
           
 String getPreferredMaster()
          Get the preferred master node.
 void setPreferredMaster(String value)
          Sets the preferred master node.
 
Methods inherited from class org.jboss.ha.singleton.HASingletonElectionPolicySimple
getPosition, setPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.ha.singleton.HASingletonElectionPolicySimpleMBean
getPosition, setPosition
 

Constructor Detail

PreferredMasterElectionPolicy

public PreferredMasterElectionPolicy()
Method Detail

setPreferredMaster

public void setPreferredMaster(String value)
Description copied from interface: PreferredMasterElectionPolicyMBean
Sets the preferred master node. As long as the preferred master node presents in the cluster, it will be always selected as master node, no matter what the election policy is.

Specified by:
setPreferredMaster in interface PreferredMasterElectionPolicyMBean
Parameters:
value - String format of ip_address:port_number or host_name:port_number.
See Also:
PreferredMasterElectionPolicyMBean.setPreferredMaster(String)

getPreferredMaster

public String getPreferredMaster()
Description copied from interface: PreferredMasterElectionPolicyMBean
Get the preferred master node.

Specified by:
getPreferredMaster in interface PreferredMasterElectionPolicyMBean
Returns:
preferred master node in ip_address:port_number or host_name:port_number format.
See Also:
PreferredMasterElectionPolicyMBean.getPreferredMaster()

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
Overrides:
elect in class HASingletonElectionPolicySimple


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.