+
+ if (!stashedDataTreeCandidates.isEmpty()) {
+ LOG.debug("Adding stashed subshards' changes {}", stashedDataTreeCandidates);
+ changes.addAll(stashedDataTreeCandidates);
+ stashedDataTreeCandidates.clear();
+ }
+
+ try {
+ applyChanges(listenerPath, changes);
+ } catch (final DataValidationFailedException e) {
+ // TODO should we fail here? What if stashed changes
+ // (changes from subshards) got ahead more than one generation
+ // from current shard. Than we can fail to apply this changes
+ // upon current data tree, but once we get respective changes
+ // from current shard, we can apply also changes from
+ // subshards.
+ //
+ // However, we can loose ability to notice and report some
+ // errors then. For example, we cannot detect potential lost
+ // changes from current shard.
+ LOG.error("Validation failed for modification built from changes {}, current data tree: {}",
+ changes, dataTree, e);
+ throw new RuntimeException("Notification validation failed", e);
+ }
+