amichair commented on code in PR #92:
URL: https://github.com/apache/aries-rsa/pull/92#discussion_r3145167077
##########
discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/Interest.java:
##########
@@ -32,67 +30,29 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@SuppressWarnings("deprecation")
public class Interest {
private static final Logger LOG = LoggerFactory.getLogger(Interest.class);
- private final ServiceReference<?> sref;
private final List<String> scopes;
- private final EndpointEventListener epListener;
+ private final EndpointEventListener listener;
- public Interest(ServiceReference<?> sref) {
- this(sref, null);
- }
-
- public Interest(ServiceReference<?> sref, EndpointEventListener
epListener) {
- this.sref = sref;
+ public Interest(ServiceReference<?> sref, EndpointEventListener listener) {
this.scopes =
StringPlus.normalize(sref.getProperty(ENDPOINT_LISTENER_SCOPE));
- this.epListener = epListener;
- }
-
- public List<String> getScopes() {
- return scopes;
+ this.listener = listener;
}
public void notifyListener(EndpointEvent event) {
EndpointDescription endpoint = event.getEndpoint();
- Optional<String> currentScope = getFirstMatch(endpoint);
- if (currentScope.isPresent()) {
- LOG.debug("Matched {} against {}", endpoint, currentScope);
- String scope = currentScope.get();
- LOG.info("Calling endpointchanged on class {} for filter {}, type
{}, endpoint {} ",
- epListener, scope, event.getType(), endpoint);
- epListener.endpointChanged(event, scope);
+ String scope =
scopes.stream().filter(endpoint::matches).findFirst().orElse(null);
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]