- checkState(proposedSubtree != null);
- checkState(storeSnapshot != null);
- // return ImmediateFuture<>;
- InMemoryDOMDataStore.this.commit(storeSnapshot, proposedSubtree);
- return Futures.<Void> immediateFuture(null);
- }
-
- }
-
- private synchronized void commit(final DataAndMetadataSnapshot storeSnapshot,
- final Optional<StoreMetadataNode> proposedSubtree) {
- //LOG.info("Updating Store snaphot.");
- checkState(snapshot == storeSnapshot, "Store snapshot and transaction snapshot differs");
- snapshot = DataAndMetadataSnapshot.builder().setMetadataTree(proposedSubtree.get())
- .setSchemaContext(schemaContext).build();
- }
-
- private class AllwaysFailOperation implements ModificationApplyOperation {
-
- @Override
- public Optional<StoreMetadataNode> apply(final NodeModification modification,
- final Optional<StoreMetadataNode> storeMeta,final UnsignedLong subtreeVersion) {
- throw new IllegalStateException("Schema Context is not available.");
- }
-
- @Override
- public boolean isApplicable(final NodeModification modification, final Optional<StoreMetadataNode> storeMetadata) {
- throw new IllegalStateException("Schema Context is not available.");
- }
-
- @Override
- public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
- throw new IllegalStateException("Schema Context is not available.");
- }
+ checkState(candidate != null, "Proposed subtree must be computed");
+
+ /*
+ * The commit has to occur atomically with regard to listener
+ * registrations.
+ */
+ synchronized (this) {
+ dataTree.commit(candidate);
+
+ for (ChangeListenerNotifyTask task : listenerResolver.call()) {
+ LOG.trace("Scheduling invocation of listeners: {}", task);
+ executor.submit(task);
+ }
+ }