Bug 4327 - Fixed DataTreeChangeListener registration in PingPongDataBroker 96/27296/3
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Tue, 22 Sep 2015 14:34:06 +0000 (16:34 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 24 Sep 2015 12:00:45 +0000 (12:00 +0000)
 - delegate broker was incorrectly queried for DOMDataTreeChangeService
 - it must ask for supported extensions instead of instanceof
 - this is lithium branch fix,
   beryllium change: https://git.opendaylight.org/gerrit/#/c/27164/

Change-Id: Ie1757c762018e7188d76a7728f2f8ea52293d73f
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
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() {
 
     @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) {
     }
 
     @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");
         }
 
         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.