Convert CDS implementation to use msdal APIs
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / sharding / DistributedShardChangePublisher.java
index 759410a26eaf9a17fc33ff1e09ffbe9d11f2e701..b4b44449c9972df3d4883d115e9e0044e01834d7 100644 (file)
@@ -154,8 +154,8 @@ public class DistributedShardChangePublisher
                 findNodeFor(listenerPath.getPathArguments());
 
         // register listener in CDS
-        final ProxyRegistration proxyReg = new ProxyRegistration(distributedDataStore
-                .registerProxyListener(shardLookup, listenerPath, listener), listener);
+        ListenerRegistration<DOMDataTreeChangeListener> listenerReg = distributedDataStore
+                .registerProxyListener(shardLookup, listenerPath, listener);
 
         @SuppressWarnings("unchecked")
         final AbstractDOMDataTreeChangeListenerRegistration<L> registration =
@@ -165,7 +165,7 @@ public class DistributedShardChangePublisher
                     listener.close();
                     DistributedShardChangePublisher.this.removeRegistration(node, this);
                     registrationRemoved(this);
-                    proxyReg.close();
+                    listenerReg.close();
                 }
             };
         addRegistration(node, registration);
@@ -194,30 +194,6 @@ public class DistributedShardChangePublisher
         return listenerPathArgs;
     }
 
-    private static final class ProxyRegistration implements ListenerRegistration<DOMDataTreeChangeListener> {
-
-        private final ListenerRegistration<org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener> proxy;
-        private final DOMDataTreeChangeListener listener;
-
-        private ProxyRegistration(
-                final ListenerRegistration<
-                        org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener> proxy,
-                final DOMDataTreeChangeListener listener) {
-            this.proxy = proxy;
-            this.listener = listener;
-        }
-
-        @Override
-        public DOMDataTreeChangeListener getInstance() {
-            return listener;
-        }
-
-        @Override
-        public void close() {
-            proxy.close();
-        }
-    }
-
     synchronized DataTreeCandidate applyChanges(final YangInstanceIdentifier listenerPath,
             final Collection<DataTreeCandidate> changes) throws DataValidationFailedException {
         final DataTreeModification modification = dataTree.takeSnapshot().newModification();