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 TypeMethodDescriptionvoidAdd the given instance to this cluster and set the cluster on the instance (back pointer)booleangetId()List<org.apache.sling.discovery.InstanceDescription> org.apache.sling.discovery.InstanceDescriptionorg.apache.sling.discovery.InstanceDescriptionReturns the local InstanceDescription or null if no local instance is listedinthashCode()booleanremoveInstanceDescription(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:
getIdin 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:
getInstancesin interfaceorg.apache.sling.discovery.ClusterView
-
getLeader
public org.apache.sling.discovery.InstanceDescription getLeader()- Specified by:
getLeaderin 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
-