public class DefaultClusterView extends Object implements org.apache.sling.discovery.ClusterView
Besides implementing the interface methods it also adds add/remove of InstanceDescriptions as well as implementing equals and hashCode.
Constructor and Description |
---|
DefaultClusterView(String id) |
Modifier and Type | Method and Description |
---|---|
void |
addInstanceDescription(DefaultInstanceDescription instance)
Add the given instance to this cluster and set the cluster on the instance (back pointer)
|
boolean |
equals(Object obj) |
String |
getId() |
List<org.apache.sling.discovery.InstanceDescription> |
getInstances() |
org.apache.sling.discovery.InstanceDescription |
getLeader() |
org.apache.sling.discovery.InstanceDescription |
getLocalInstance()
Returns the local InstanceDescription or null if no local instance is listed
|
int |
hashCode() |
boolean |
removeInstanceDescription(org.apache.sling.discovery.InstanceDescription instance)
Removes the given instance from this cluster.
|
String |
toString() |
public DefaultClusterView(String id)
public String getId()
getId
in interface org.apache.sling.discovery.ClusterView
public void addInstanceDescription(DefaultInstanceDescription instance)
instance
- the instance to add to this clusterpublic List<org.apache.sling.discovery.InstanceDescription> getInstances()
getInstances
in interface org.apache.sling.discovery.ClusterView
public org.apache.sling.discovery.InstanceDescription getLeader()
getLeader
in interface org.apache.sling.discovery.ClusterView
public boolean removeInstanceDescription(org.apache.sling.discovery.InstanceDescription instance)
Note that the instance will still have a pointer to this cluster however.
instance
- the instance to remove from this clusterpublic org.apache.sling.discovery.InstanceDescription getLocalInstance()
IllegalStateException
- if multiple local instances are listedCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.