+ SettableFuture<Void> readinessFuture() {
+ return readinessFuture;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerProxyListener(
+ final YangInstanceIdentifier shardLookup, final YangInstanceIdentifier insideShard,
+ final DOMDataTreeChangeListener delegate) {
+
+ requireNonNull(shardLookup, "shardLookup should not be null");
+ requireNonNull(insideShard, "insideShard should not be null");
+ requireNonNull(delegate, "delegate should not be null");
+
+ final String shardName = actorUtils.getShardStrategyFactory().getStrategy(shardLookup).findShard(shardLookup);
+ LOG.debug("Registering tree listener: {} for tree: {} shard: {}, path inside shard: {}",
+ delegate,shardLookup, shardName, insideShard);
+
+ // wrap this in the ClusteredDOMDataTreeChangeLister interface
+ // since we always want clustered registration
+ final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> listenerRegistrationProxy =
+ new DataTreeChangeListenerProxy<>(actorUtils, new ClusteredDOMDataTreeChangeListener() {
+ @Override
+ public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
+ delegate.onDataTreeChanged(changes);
+ }
+
+ @Override
+ public void onInitialData() {
+ delegate.onInitialData();
+ }
+ }, insideShard);
+ listenerRegistrationProxy.init(shardName);
+
+ return (ListenerRegistration<L>) listenerRegistrationProxy;
+ }
+
+ private Duration initialSettleTime() {
+ final DatastoreContext context = actorUtils.getDatastoreContext();
+ final int multiplier = context.getInitialSettleTimeoutMultiplier();
+ return multiplier == 0 ? Duration.Inf() : context.getShardLeaderElectionTimeout().duration().$times(multiplier);