com.cloudtran.replicator.isolator
Class DefaultReplicatorElecter

java.lang.Object
  extended by com.cloudtran.replicator.isolator.DefaultReplicatorElecter
All Implemented Interfaces:
ReplicatorElecter

public class DefaultReplicatorElecter
extends Object
implements ReplicatorElecter

This is the default ReplicatorElecter. The node it chooses to be the replicator will be


Constructor Summary
DefaultReplicatorElecter()
           
 
Method Summary
 Member elect(Member thisMember, Member currentReplicator, Member[] availableIsolators)
          This method only gets called on an isolator, after it has been elected the primary isolator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultReplicatorElecter

public DefaultReplicatorElecter()
Method Detail

elect

public Member elect(Member thisMember,
                    Member currentReplicator,
                    Member[] availableIsolators)
Description copied from interface: ReplicatorElecter
This method only gets called on an isolator, after it has been elected the primary isolator. Once we know that, we can elect the new replicator.

Specified by:
elect in interface ReplicatorElecter
Parameters:
thisMember - The current member. This will be the newly elected Isolator
currentReplicator - the current replicator Member. If there is no active replicator, currentReplicator will be null. currentReplicator may be non-null but may represent a Member that has left the cluster.
availableIsolators - The available Isolators. This will include thisMember. It may also be of length 1, in which case you should return thisMember.
Returns:
Return the newly elected Isolator Member, chosen from availableIsolators. If you have a choice, avoid this member, to improve performance on the primary Isolator.

If there is a backup storage available on some Isolators but not all, you should take this into account in selecting the new replicator.

If the current replicator is still alive, the current implementation does not allow you to change it.

See Also:
ReplicatorElecter#elect(Member, Member, Member[])} This is called from the new (i.e. just-elected) primary isolator to elect the new Replicator.