From babc1ee03ad860e6bc806f830571521f93c89f29 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 2 Aug 2017 16:53:09 +0200 Subject: [PATCH] BUG-8733: eliminate ProxyRegistration This class does not serve any real purpose and just clutters the code. Get rid of it. Change-Id: I43b88bc8eb777199a43283c3b232a299436cd74d Signed-off-by: Robert Varga --- .../DistributedShardChangePublisher.java | 38 +++---------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardChangePublisher.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardChangePublisher.java index 95476475e7..298328c993 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardChangePublisher.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardChangePublisher.java @@ -45,7 +45,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaValidationFai import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DistributedShardChangePublisher +final class DistributedShardChangePublisher extends AbstractRegistrationTree> implements DOMStoreTreeChangePublisher { @@ -62,10 +62,8 @@ public class DistributedShardChangePublisher @GuardedBy("this") private final DataTree dataTree; - public DistributedShardChangePublisher(final DataStoreClient client, - final AbstractDataStore distributedDataStore, - final DOMDataTreeIdentifier prefix, - final Map childShards) { + DistributedShardChangePublisher(final DataStoreClient client, final AbstractDataStore distributedDataStore, + final DOMDataTreeIdentifier prefix, final Map childShards) { this.client = client; this.distributedDataStore = distributedDataStore; // TODO keeping the whole dataTree thats contained in subshards doesn't seem like a good idea @@ -139,8 +137,8 @@ public class DistributedShardChangePublisher findNodeFor(listenerPath.getPathArguments()); // register listener in CDS - final ProxyRegistration proxyReg = new ProxyRegistration(distributedDataStore - .registerProxyListener(shardLookup, listenerPath, listener), listener); + final ListenerRegistration dsReg = distributedDataStore.registerProxyListener(shardLookup, listenerPath, + listener); @SuppressWarnings("unchecked") final AbstractDOMDataTreeChangeListenerRegistration registration = @@ -150,7 +148,7 @@ public class DistributedShardChangePublisher listener.close(); DistributedShardChangePublisher.this.removeRegistration(node, this); registrationRemoved(this); - proxyReg.close(); + dsReg.close(); } }; addRegistration(node, registration); @@ -179,30 +177,6 @@ public class DistributedShardChangePublisher return listenerPathArgs; } - private static class ProxyRegistration implements ListenerRegistration { - - private final ListenerRegistration 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 changes) throws DataValidationFailedException { final DataTreeModification modification = dataTree.takeSnapshot().newModification(); -- 2.36.6