Class ClusterViewManager


  • public class ClusterViewManager
    extends java.lang.Object
    Manages Cluster Views and notifies cluster view listeners when cluster view changes
    • Constructor Detail

      • ClusterViewManager

        public ClusterViewManager​(SystemAdvertisement advertisement,
                                  ClusterManager manager,
                                  java.util.List<ClusterViewEventListener> listeners)
        Constructor for the ClusterViewManager object
        Parameters:
        advertisement - the advertisement of the instance associated with this object
        manager - the cluster manager
        listeners - List of ClusterViewEventListener
    • Method Detail

      • start

        public void start()
      • getMaster

        public SystemAdvertisement getMaster()
        Gets the master advertisement
        Returns:
        SystemAdvertisement Master system adverisement
      • get

        public SystemAdvertisement get​(PeerID id)
        Retrieves a system advertisement from a the table
        Parameters:
        id - instance id
        Returns:
        Returns the SystemAdvertisement associated with id
      • containsKey

        public boolean containsKey​(PeerID id)
      • containsKey

        public boolean containsKey​(PeerID id,
                                   boolean debug)
      • getLocalView

        public ClusterView getLocalView()
        Returns a sorted localView
        Returns:
        The localView List
      • getViewSize

        public int getViewSize()
        Gets the viewSize attribute of the ClusterViewManager object
        Returns:
        The viewSize
      • isMaster

        public boolean isMaster()
        Determines whether this node is the Master
        Returns:
        true if this node is the master node
      • isFirst

        public boolean isFirst()
        Determines whether this node is at the top of the list
        Returns:
        true if this node is a the top of the list, false otherwise
      • indexOf

        public int indexOf​(PeerID id)
        the index of id this view, or -1 if this view does not contain this element.
        Parameters:
        id - id
        Returns:
        the index of id this view, or -1 if this view does not contain this element.
      • getID

        public PeerID getID​(java.lang.String name)
      • setPeerNoLongerInDoubtState

        public void setPeerNoLongerInDoubtState​(SystemAdvertisement adv)
      • getMasterViewID

        public long getMasterViewID()
      • setMasterViewID

        public void setMasterViewID​(long masterViewID)