- final NotificationHandler.NotificationFilter filter = new NotificationHandler.NotificationFilter() {
- @Override
- public Optional<DOMNotification> filterNotification(final DOMNotification notification) {
- if (isCapabilityChanged(notification)) {
- LOG.info("{}: Schemas change detected, reconnecting", id);
- // Only disconnect is enough,
- // the reconnecting nature of the connector will take care of reconnecting
- listener.disconnect();
- return Optional.empty();
- }
- return Optional.of(notification);
- }
-
- private boolean isCapabilityChanged(final DOMNotification notification) {
- return notification.getBody().getNodeType().equals(NetconfCapabilityChange.QNAME);
- }
- };
-