import java.util.Collections;
import java.util.List;
import java.util.Objects;
-import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
// Only disconnect is enough,
// the reconnecting nature of the connector will take care of reconnecting
listener.disconnect();
- return Optional.empty();
+ return false;
}
- return Optional.of(notification);
+ return true;
});
}
import java.util.LinkedList;
import java.util.List;
-import java.util.Optional;
+import java.util.function.Predicate;
import org.opendaylight.mdsal.dom.api.DOMNotification;
import org.opendaylight.netconf.api.NetconfMessage;
import org.opendaylight.netconf.api.xml.XmlUtil;
private synchronized void passNotification(final DOMNotification parsedNotification) {
LOG.debug("{}: Forwarding notification {}", id, parsedNotification);
- if (filter == null || filter.filterNotification(parsedNotification).isPresent()) {
+ if (filter == null || filter.test(parsedNotification)) {
salFacade.onNotification(parsedNotification);
}
}
messageTransformer = null;
}
- interface NotificationFilter {
+ @FunctionalInterface
+ interface NotificationFilter extends Predicate<DOMNotification> {
- Optional<DOMNotification> filterNotification(DOMNotification notification);
}
}