in discovery/mdns/src/main/java/org/apache/aries/rsa/discovery/mdns/InterestManager.java [108:133]
private void onEndpointEvent(String source, InboundSseEvent event) {
String name = event.getName();
if(LOG.isDebugEnabled()) {
LOG.debug("Received a {} notification from {}", name, source);
}
if(ENDPOINT_UPDATED.equals(name)) {
EndpointDescription ed = parser.readEndpoint(event.readData(InputStream.class));
endpointsBySource.compute(source, (a,b) -> {
return b == null ? singleton(ed) : concat(b.stream(), Stream.of(ed)).collect(toSet());
});
interests.values().forEach(i -> i.endpointChanged(ed));
} else if (ENDPOINT_REVOKED.equals(name)) {
String id = event.readData();
endpointsBySource.compute(source, (a,b) -> {
if(b == null) {
return null;
} else {
Set<EndpointDescription> set = b.stream().filter(ed -> !ed.getId().equals(id)).collect(toSet());
return set.isEmpty() ? null : set;
}
});
interests.values().forEach(i -> i.endpointRemoved(id));
}
}