synchronized void handleNotification(final NetconfMessage notification) {
if(passNotifications) {
- passNotification(messageTransformer.toNotification(notification));
+ passNotification(transformNotification(notification));
} else {
queueNotification(notification);
}
passNotifications = true;
for (final NetconfMessage cachedNotification : queue) {
- final CompositeNode parsedNotification = messageTransformer.toNotification(cachedNotification);
- // TODO possible race condition here, because this exception is thrown occasionally
- Preconditions.checkNotNull(parsedNotification, "Unable to parse received notification %s", cachedNotification);
- passNotification(parsedNotification);
+ passNotification(transformNotification(cachedNotification));
}
queue.clear();
}
+ private CompositeNode transformNotification(final NetconfMessage cachedNotification) {
+ final CompositeNode parsedNotification = messageTransformer.toNotification(cachedNotification);
+ Preconditions.checkNotNull(parsedNotification, "%s: Unable to parse received notification: %s", id, cachedNotification);
+ return parsedNotification;
+ }
+
private void queueNotification(final NetconfMessage notification) {
Preconditions.checkState(passNotifications == false);
this.filter = filter;
}
+ synchronized void onRemoteSchemaDown() {
+ queue.clear();
+ passNotifications = false;
+ }
+
static interface NotificationFilter {
Optional<CompositeNode> filterNotification(CompositeNode notification);