Bug 4327 - Fixed DataTreeChangeListener registration in PingPongDataBroker
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / PingPongDataBroker.java
index 55f8a15..53de1a2 100644 (file)
@@ -49,13 +49,15 @@ public final class PingPongDataBroker extends ForwardingDOMDataBroker implements
 
     @Override
     public void close() {
-        // TODO Auto-generated method stub
+        // intentionally NOOP
     }
 
     @Override
     public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) {
-        if (delegate instanceof DOMDataTreeChangeService) {
-            return ((DOMDataTreeChangeService)delegate).registerDataTreeChangeListener(treeId, listener);
+        final DOMDataTreeChangeService treeService =
+                (DOMDataTreeChangeService) delegate.getSupportedExtensions().get(DOMDataTreeChangeService.class);
+        if (treeService != null) {
+            return treeService.registerDataTreeChangeListener(treeId, listener);
         }
 
         throw new UnsupportedOperationException("Delegate " + delegate + " does not support required functionality");

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.