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;
.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(),
return (ListenerRegistration<L>) listenerRegistrationProxy;
}
+ @SuppressWarnings("unchecked")
+ public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> 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<DOMDataTreeChangeListener> proxy =
+ new DataTreeChangeListenerProxy<>(actorContext, delegate, internalPath);
+ proxy.init(ClusterUtils.PREFIX_CONFIG_SHARD_ID);
+
+ return (ListenerRegistration<L>) proxy;
+ }
+
}