Class DefaultClusterView

  • All Implemented Interfaces:
    ClusterView
    Direct Known Subclasses:
    LocalClusterView

    @Deprecated(since="2021-09-30")
    public class DefaultClusterView
    extends Object
    implements ClusterView
    Deprecated.
    This API is not supported in Cloud Service.
    Default implementation of the ClusterView interface.

    Besides implementing the interface methods it also adds add/remove of InstanceDescriptions as well as implementing equals and hashCode.

    • Constructor Detail

      • DefaultClusterView

        public DefaultClusterView​(String id)
        Deprecated.
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Deprecated.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Deprecated.
        Overrides:
        hashCode in class Object
      • getId

        public String getId()
        Deprecated.
        Description copied from interface: ClusterView
        Returns a stable id of the cluster represented by this cluster view.

        Similar to the SlingID, this id is persisted and thus remains stable accross instance/cluster restarts.

        When an instance joins a cluster, it will inherit the id from the joined cluster (thus incurs a cluster id change).

        Note: When instances part from a cluster (eg due to a network partitioning) the cluster id is retained. This results in potentially multiple clusters with the same id. This fact could be used to detect such partitioning/split brain situations. It also implies though that the cluster id is not guaranteed to be unique in a topology!

        Addition in 1.0.4: this id must consist only of alphanumeric characters plus dash '-' and underscore '_'.

        Specified by:
        getId in interface ClusterView
        Returns:
        an id of this cluster view
        See Also:
        SLING-3164
      • addInstanceDescription

        public void addInstanceDescription​(DefaultInstanceDescription instance)
        Deprecated.
        Add the given instance to this cluster and set the cluster on the instance (back pointer)
        Parameters:
        instance - the instance to add to this cluster
      • getInstances

        public List<InstanceDescription> getInstances()
        Deprecated.
        Description copied from interface: ClusterView
        Provides the list of InstanceDescriptions with a stable ordering.

        Stable ordering implies that unless an instance leaves the cluster (due to shutdown/crash/network problems) the instance keeps the relative position in the list.

        Specified by:
        getInstances in interface ClusterView
        Returns:
        the list of InstanceDescriptions (with a stable ordering)
      • getLeader

        public InstanceDescription getLeader()
        Deprecated.
        Description copied from interface: ClusterView
        Provides the InstanceDescription belonging to the leader instance.

        Every ClusterView is guaranteed to have one and only one leader.

        The leader is stable: once a leader is elected it stays leader unless it leaves the cluster (due to shutdown/crash/network problems)

        Specified by:
        getLeader in interface ClusterView
        Returns:
        the InstanceDescription belonging to the leader instance
      • removeInstanceDescription

        public boolean removeInstanceDescription​(InstanceDescription instance)
        Deprecated.
        Removes the given instance from this cluster.

        Note that the instance will still have a pointer to this cluster however.

        Parameters:
        instance - the instance to remove from this cluster
      • getLocalInstance

        public InstanceDescription getLocalInstance()
        Deprecated.
        Returns the local InstanceDescription or null if no local instance is listed
        Returns:
        the local InstanceDescription or null if no local instance is listed
        Throws:
        IllegalStateException - if multiple local instances are listed