- @SuppressWarnings("unchecked")
- @Override
- public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
- ListenerRegistration<L> registerChangeListener(
- final YangInstanceIdentifier path, L listener,
- AsyncDataBroker.DataChangeScope scope) {
-
- Preconditions.checkNotNull(path, "path should not be null");
- Preconditions.checkNotNull(listener, "listener should not be null");
-
- LOG.debug("Registering listener: {} for path: {} scope: {}", listener, path, scope);
-
- String shardName = actorContext.getShardStrategyFactory().getStrategy(path).findShard(path);
-
- final DataChangeListenerRegistrationProxy listenerRegistrationProxy =
- new DataChangeListenerRegistrationProxy(shardName, actorContext, listener);
- listenerRegistrationProxy.init(path, scope);
-
- return listenerRegistrationProxy;
- }
-
- @Override
- public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(YangInstanceIdentifier treeId, L listener) {
- Preconditions.checkNotNull(treeId, "treeId should not be null");
- Preconditions.checkNotNull(listener, "listener should not be null");
-
- final String shardName = actorContext.getShardStrategyFactory().getStrategy(treeId).findShard(treeId);
- LOG.debug("Registering tree listener: {} for tree: {} shard: {}", listener, treeId, shardName);
-
- final DataTreeChangeListenerProxy<L> listenerRegistrationProxy =
- new DataTreeChangeListenerProxy<L>(actorContext, listener);
- listenerRegistrationProxy.init(shardName, treeId);
-
- return listenerRegistrationProxy;
- }
-
-
- @Override
- public <C extends DOMDataTreeCommitCohort> DOMDataTreeCommitCohortRegistration<C> registerCommitCohort(
- DOMDataTreeIdentifier subtree, C cohort) {
- YangInstanceIdentifier treeId =
- Preconditions.checkNotNull(subtree, "subtree should not be null").getRootIdentifier();
- Preconditions.checkNotNull(cohort, "listener should not be null");
-
-
- final String shardName = actorContext.getShardStrategyFactory().getStrategy(treeId).findShard(treeId);
- LOG.debug("Registering cohort: {} for tree: {} shard: {}", cohort, treeId, shardName);
-
- DataTreeCohortRegistrationProxy<C> cohortProxy = new DataTreeCohortRegistrationProxy<C>(actorContext, subtree, cohort);
- cohortProxy.init(shardName);
- return cohortProxy;
- }