Class DefaultClusterView
java.lang.Object
org.apache.sling.discovery.commons.providers.DefaultClusterView
- All Implemented Interfaces:
org.apache.sling.discovery.ClusterView
- Direct Known Subclasses:
LocalClusterView
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given instance to this cluster and set the cluster on the instance (back pointer)boolean
getId()
List
<org.apache.sling.discovery.InstanceDescription> org.apache.sling.discovery.InstanceDescription
org.apache.sling.discovery.InstanceDescription
Returns the local InstanceDescription or null if no local instance is listedint
hashCode()
boolean
removeInstanceDescription
(org.apache.sling.discovery.InstanceDescription instance) Removes the given instance from this cluster.toString()
-
Constructor Details
-
DefaultClusterView
-
-
Method Details
-
equals
-
toString
-
hashCode
public int hashCode() -
getId
- Specified by:
getId
in interfaceorg.apache.sling.discovery.ClusterView
-
addInstanceDescription
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
- Specified by:
getInstances
in interfaceorg.apache.sling.discovery.ClusterView
-
getLeader
public org.apache.sling.discovery.InstanceDescription getLeader()- Specified by:
getLeader
in interfaceorg.apache.sling.discovery.ClusterView
-
removeInstanceDescription
public boolean removeInstanceDescription(org.apache.sling.discovery.InstanceDescription instance) 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 org.apache.sling.discovery.InstanceDescription getLocalInstance()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
-