com.sleepycat.je.rep.stream
Class MasterStatus

java.lang.Object
  extended by com.sleepycat.je.rep.stream.MasterStatus
All Implemented Interfaces:
Cloneable

public class MasterStatus
extends Object
implements Cloneable

Class used by a node to track changes in Master Status. It's updated by the Listener. It represents the abstract notion that the notion of the current Replica Group is definitive and is always in advance of the notion of a master at each node. A node is typically playing catch up as it tries to bring its view in line with that of the group.


Nested Class Summary
 class MasterStatus.MasterSyncException
           
 
Constructor Summary
MasterStatus(NameIdPair nameIdPair)
           
 
Method Summary
 void assertSync()
          An assertion form of the above.
 Object clone()
          Returns a read-only snapshot of the object.
 NameIdPair getGroupMasterNameId()
           
 InetSocketAddress getNodeMaster()
          Returns the Node's current idea of the Master.
 NameIdPair getNodeMasterNameId()
           
 boolean inSync()
          Predicate to determine whether the group and node have a consistent notion of the Master.
 boolean isGroupMaster()
          Returns true if it's the master from the Group's perspective
 boolean isNodeMaster()
          Returns true if it's the master from the node's localized perspective
 void setGroupMaster(InetSocketAddress newGroupMaster, NameIdPair newGroupMasterNameId)
           
 void sync()
          Syncs to the group master
 void unSync()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterStatus

public MasterStatus(NameIdPair nameIdPair)
Method Detail

clone

public Object clone()
Returns a read-only snapshot of the object.

Overrides:
clone in class Object

isGroupMaster

public boolean isGroupMaster()
Returns true if it's the master from the Group's perspective


isNodeMaster

public boolean isNodeMaster()
Returns true if it's the master from the node's localized perspective


setGroupMaster

public void setGroupMaster(InetSocketAddress newGroupMaster,
                           NameIdPair newGroupMasterNameId)

inSync

public boolean inSync()
Predicate to determine whether the group and node have a consistent notion of the Master.

Returns:
false if the node does not know of a Master, of the group Master is different from the node's notion the master.

unSync

public void unSync()

assertSync

public void assertSync()
                throws MasterStatus.MasterSyncException
An assertion form of the above. By combining the check and exception generation in an atomic operation, it provides for an accurate exception message.

Throws:
MasterStatus.MasterSyncException

sync

public void sync()
Syncs to the group master


getNodeMaster

public InetSocketAddress getNodeMaster()
Returns the Node's current idea of the Master. It may be "out of sync" with the Group's notion of the Master


getNodeMasterNameId

public NameIdPair getNodeMasterNameId()

getGroupMasterNameId

public NameIdPair getGroupMasterNameId()


Copyright (c) 2004-2010 Oracle. All rights reserved.