X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractDataStore.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractDataStore.java;h=c0bb8662babccd23538eed8bce9f6378e7f2636f;hp=dce5368218f30685f30fcc2894a5be73c08cab5a;hb=149feb98f151186975fe42bab5853e05aafd4b51;hpb=bf6ccadd95d2e23246a51380ee38c0b45667c979 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractDataStore.java index dce5368218..c0bb8662ba 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractDataStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractDataStore.java @@ -28,6 +28,7 @@ import org.opendaylight.controller.cluster.datastore.jmx.mbeans.DatastoreInfoMXB import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot; import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManagerCreator; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; +import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils; import org.opendaylight.controller.cluster.datastore.utils.Dispatchers; import org.opendaylight.controller.cluster.datastore.utils.PrimaryShardInfoFutureCache; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; @@ -94,7 +95,8 @@ public abstract class AbstractDataStore implements DistributedDataStoreInterface .datastoreContextFactory(datastoreContextFactory) .waitTillReadyCountDownLatch(waitTillReadyCountDownLatch) .primaryShardInfoCache(primaryShardInfoCache) - .restoreFromSnapshot(restoreFromSnapshot); + .restoreFromSnapshot(restoreFromSnapshot) + .distributedDataStore(this); actorContext = new ActorContext(actorSystem, createShardManager(actorSystem, creator, shardDispatcher, shardManagerId), cluster, configuration, datastoreContextFactory.getBaseDatastoreContext(), @@ -319,4 +321,19 @@ public abstract class AbstractDataStore implements DistributedDataStoreInterface return (ListenerRegistration) listenerRegistrationProxy; } + @SuppressWarnings("unchecked") + public ListenerRegistration registerShardConfigListener( + final YangInstanceIdentifier internalPath, + final DOMDataTreeChangeListener delegate) { + Preconditions.checkNotNull(delegate, "delegate should not be null"); + + LOG.debug("Registering a listener for the configuration shard: {}", internalPath); + + final DataTreeChangeListenerProxy proxy = + new DataTreeChangeListenerProxy<>(actorContext, delegate, internalPath); + proxy.init(ClusterUtils.PREFIX_CONFIG_SHARD_ID); + + return (ListenerRegistration) proxy; + } + }