public class DefaultInstanceDescription extends java.lang.Object implements InstanceDescription
Allows creation of the object with clusterview and/or properties null - to be set later but before usage!
PROPERTY_DESCRIPTION, PROPERTY_ENDPOINTS, PROPERTY_NAME
Constructor and Description |
---|
DefaultInstanceDescription(DefaultClusterView clusterView,
boolean isLeader,
boolean isOwn,
java.lang.String slingId,
java.util.Map<java.lang.String,java.lang.String> properties) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
ClusterView |
getClusterView()
Returns the ClusterView of which this instance is part of.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns a Map containing all properties of this instance.
|
java.lang.String |
getProperty(java.lang.String name)
Returns the value of a particular property.
|
java.lang.String |
getSlingId()
The identifier of the running Sling instance.
|
int |
hashCode() |
boolean |
isLeader()
If an instance is part of a cluster, it can potentially be a leader of that cluster -
this information is queried here.
|
boolean |
isLocal()
Determines whether this InstanceDescription is representing the local instance.
|
void |
setProperty(java.lang.String key,
java.lang.String value)
for testing only!
|
java.lang.String |
toString() |
public DefaultInstanceDescription(DefaultClusterView clusterView, boolean isLeader, boolean isOwn, java.lang.String slingId, java.util.Map<java.lang.String,java.lang.String> properties)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public ClusterView getClusterView()
InstanceDescription
Every instance is part of a ClusterView even if it is standalone.
getClusterView
in interface InstanceDescription
public boolean isLeader()
InstanceDescription
If an instance is not part of a cluster, this method returns true.
Only one instance of a cluster is guaranteed to be the leader at any time. This guarantee is provided by this service. If the leader goes down, the service elects a new leader and announces it to TopologyEventListener listeners.
isLeader
in interface InstanceDescription
public boolean isLocal()
InstanceDescription
isLocal
in interface InstanceDescription
public java.lang.String getSlingId()
InstanceDescription
getSlingId
in interface InstanceDescription
public java.lang.String getProperty(java.lang.String name)
InstanceDescription
Note that there are no hard guarantees or requirements as to how quickly a property is available once it is set on a distant instance.
getProperty
in interface InstanceDescription
name
- The property namenull
DiscoveryService#setProperty(String, String)
public java.util.Map<java.lang.String,java.lang.String> getProperties()
InstanceDescription
getProperties
in interface InstanceDescription
public void setProperty(java.lang.String key, java.lang.String value)
Copyright © 2010 - 2020 Adobe. All Rights Reserved