public class DefaultTopologyView extends BaseTopologyView
Constructor and Description |
---|
DefaultTopologyView()
Create a new empty topology
|
DefaultTopologyView(Collection<InstanceDescription> instances)
Create a new topology filled with the given list of instances
|
Modifier and Type | Method and Description |
---|---|
void |
addInstances(Collection<InstanceDescription> instances)
Adds the given instances to this topology
|
TopologyEvent.Type |
compareTopology(DefaultTopologyView other)
Compare this topology with the given one and determine how they compare
|
boolean |
equals(Object obj) |
Set<InstanceDescription> |
findInstances(InstanceFilter picker)
Searches through this topology and picks those accepted by the provided
InstanceFilter - and returns them without any particular order |
Set<ClusterView> |
getClusterViews()
Provides the collection of ClusterViews.
|
Set<InstanceDescription> |
getInstances()
Provides the set of InstanceDescriptions in the entire topology,
without any particular order
|
String |
getLocalClusterSyncTokenId()
Returns the id that shall be used in the syncToken
by the ClusterSyncService.
|
InstanceDescription |
getLocalInstance()
Provides the InstanceDescription belonging to this instance.
|
int |
hashCode() |
void |
setLocalClusterView(LocalClusterView localClusterView)
Adds the instances of the given ClusterView to this topology
|
String |
toString() |
getInstance, isCurrent, setNotCurrent, toShortString
public DefaultTopologyView()
public DefaultTopologyView(Collection<InstanceDescription> instances)
public TopologyEvent.Type compareTopology(DefaultTopologyView other)
other
- the other topology against which to compareTopologyEvent.Type
public InstanceDescription getLocalInstance()
TopologyView
TopologyView.getLocalInstance()
public Set<InstanceDescription> getInstances()
TopologyView
TopologyView.getInstances()
public void setLocalClusterView(LocalClusterView localClusterView)
public void addInstances(Collection<InstanceDescription> instances)
public Set<InstanceDescription> findInstances(InstanceFilter picker)
TopologyView
InstanceFilter
- and returns them without any particular orderpicker
- the filter to useTopologyView.findInstances(org.apache.sling.discovery.InstanceFilter)
public Set<ClusterView> getClusterViews()
TopologyView
Note that all InstanceDescriptions belong to exactly one ClusterView - including InstanceDescriptions that form "a cluster of 1"
TopologyView.getClusterViews()
public String getLocalClusterSyncTokenId()
BaseTopologyView
The clusterSyncId uniquely identifies each change of the local cluster for all participating instances. That means, all participating instances know of the clusterSyncId and it is the same for all instances. Whenever an instance joins/leaves the cluster, this clusterSyncId must change.
Since this method returns the *local* clusterSyncId, it doesn't care if a remote cluster experienced changes - it must only change when the local cluster changes. However, it *can* change when a remote cluster changes too. So the requirement is just that it changes *at least* when the local cluster changes - but implementations can opt to regard this rather as a TopologyView-ID too (ie an ID that identifies a particular incarnation of the TopologyView for all participating instances in the whole topology).
This id can further safely be used by the ClusterSyncService to identify a syncToken that it writes and that all other instances in the lcoal cluster wait for, before sending a TOPOLOGY_CHANGED event.
Note that this is obviously not to be confused with the ClusterView.getId() which is stable throughout the lifetime of a cluster.
getLocalClusterSyncTokenId
in class BaseTopologyView
Copyright © 2017 The Apache Software Foundation. All rights reserved.