public class DefaultInstanceDescription extends 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,
String slingId,
Map<String,String> properties) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
ClusterView |
getClusterView()
Returns the ClusterView of which this instance is part of.
|
Map<String,String> |
getProperties()
Returns a Map containing all properties of this instance.
|
String |
getProperty(String name)
Returns the value of a particular property.
|
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.
|
protected void |
setProperties(Map<String,String> properties)
Sets the properties of this instance
|
void |
setProperty(String key,
String value)
for testing only!
|
String |
toString() |
public DefaultInstanceDescription(DefaultClusterView clusterView, boolean isLeader, boolean isOwn, String slingId, Map<String,String> properties)
public ClusterView getClusterView()
InstanceDescriptionEvery instance is part of a ClusterView even if it is standalone.
getClusterView in interface InstanceDescriptionpublic boolean isLeader()
InstanceDescriptionIf 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 InstanceDescriptionpublic boolean isLocal()
InstanceDescriptionisLocal in interface InstanceDescriptionpublic String getSlingId()
InstanceDescriptiongetSlingId in interface InstanceDescriptionpublic String getProperty(String name)
InstanceDescriptionNote 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 InstanceDescriptionname - The property namenullDiscoveryService#setProperty(String, String)public Map<String,String> getProperties()
InstanceDescriptiongetProperties in interface InstanceDescriptionprotected void setProperties(Map<String,String> properties)
properties - Copyright © 2017 The Apache Software Foundation. All rights reserved.