Bug 2351: Introduced LazySerializedDOMNotification
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / impl / BindingDOMNotificationListenerAdapter.java
index c9a1756435538acfade024a0317f5abedb144c67..668030e1a6f00572c7862d5a93f019f2d78eeed6 100644 (file)
@@ -38,12 +38,18 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
 
     @Override
     public void onNotification(@Nonnull final DOMNotification notification) {
-        final Notification baNotification =
-                codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
+        final Notification baNotification = deserialize(notification);
         final QName notificationQName = notification.getType().getLastComponent();
         getInvoker(notification.getType()).invokeNotification(delegate, notificationQName, baNotification);
     }
 
+    private Notification deserialize(final DOMNotification notification) {
+        if(notification instanceof LazySerializedDOMNotification) {
+            return ((LazySerializedDOMNotification) notification).getBindingData();
+        }
+        return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
+    }
+
     private NotificationListenerInvoker getInvoker(final SchemaPath type) {
         return invokers.get(type);
     }