public void update()

in discovery/mdns/src/main/java/org/apache/aries/rsa/discovery/mdns/Interest.java [57:87]


    public void update(Map<String, Object> props) {
        
        List<String> newScopes = StringPlus.normalize(props.get(ENDPOINT_LISTENER_SCOPE));
        List<String> oldScopes = this.scopes.getAndSet(newScopes);
        
        added.values().removeIf(ed -> {
            Optional<String> newScope = getFirstMatch(ed, newScopes);
            Optional<String> oldScope = getFirstMatch(ed, oldScopes);
            EndpointEvent event;
            boolean remove;
            String filter;
            if(newScope.isPresent()) {
                remove = false;
                filter = newScope.get();
                if(oldScope.isPresent() && oldScope.get().equals(filter)) {
                    event = null;
                } else {
                    event = new EndpointEvent(MODIFIED, ed);
                }
            } else {
                remove = true;
                event = new EndpointEvent(REMOVED, ed);
                filter = oldScope.orElse(null);
            }

            if (event != null)
                notifyListener(event, filter);
            
            return remove;
        });
    }