+ /*
+ * We need to potentially deal with multi-shard composition for registration targeting the root of the data
+ * store. If that is the case, we delegate to a more complicated setup invol
+ */
+ if (treeId.isEmpty()) {
+ // User is targeting root of the datastore. If there is more than one shard, we have to register with them
+ // all and perform data composition.
+ final Set<String> shardNames = actorUtils.getConfiguration().getAllShardNames();
+ if (shardNames.size() > 1) {
+ checkArgument(listener instanceof ClusteredDOMDataTreeChangeListener,
+ "Cannot listen on root without non-clustered listener %s", listener);
+ return new RootDataTreeChangeListenerProxy<>(actorUtils, listener, shardNames);
+ }
+ }
+