in src/main/java/org/apache/sling/discovery/impl/cluster/ClusterViewChangeListener.java [121:165]
public void handleEvent(final Event event) {
final String resourcePath = (String) event.getProperty("path");
if (config==null) {
return;
}
final String establishedViewPath = config.getEstablishedViewPath();
final String clusterInstancesPath = config.getClusterInstancesPath();
if (resourcePath == null) {
// not of my business
return;
}
// properties: path, resourceChangedAttributes, resourceType,
// event.topics
if (resourcePath.startsWith(establishedViewPath)) {
if (logger.isDebugEnabled()) {
logger.debug("handleEvent: establishedViewPath resourcePath="
+ resourcePath + ", event=" + event);
}
handleTopologyChanged();
} else if (resourcePath.startsWith(clusterInstancesPath)) {
final Object resourceChangedAttributes = event
.getProperty("resourceChangedAttributes");
if (resourceChangedAttributes != null
&& resourceChangedAttributes instanceof String[]) {
String[] resourceChangedAttributesStrings = (String[]) resourceChangedAttributes;
if (resourceChangedAttributesStrings.length == 1
&& resourceChangedAttributesStrings[0]
.equals("lastHeartbeat")) {
// then ignore this one
return;
}
}
if (logger.isDebugEnabled()) {
logger.debug("handleEvent: clusterInstancesPath (announcement or properties) resourcePath="
+ resourcePath + ", event=" + event);
}
handleTopologyChanged();
} else {
// not of my business
return;
}
}