return dataTree.takeSnapshot().newModification();
}
- /**
- * Commits a modification.
- *
- * @deprecated This method violates DataTree containment and will be removed.
- */
- @VisibleForTesting
- @Deprecated
- public DataTreeCandidate commit(final DataTreeModification modification) throws DataValidationFailedException {
- // Direct modification commit is a utility, which cannot be used while we have transactions in-flight
- Preconditions.checkState(tip == dataTree, "Cannot modify data tree while transacgitons are pending");
-
- modification.ready();
- dataTree.validate(modification);
- DataTreeCandidate candidate = dataTree.prepare(modification);
- dataTree.commit(candidate);
- return candidate;
- }
-
public Collection<ShardDataTreeCohort> getAndClearPendingTransactions() {
Collection<ShardDataTreeCohort> ret = new ArrayList<>(getQueueSize());
BatchedModifications batched = newBatchedModifications(nextTransactionId(), id, node, true, true, 1);
DataTreeModification modification = store.getDataTree().takeSnapshot().newModification();
batched.apply(modification);
- store.notifyListeners(store.commit(modification));
+ store.notifyListeners(commitTransaction(store.getDataTree(), modification));
}
public static void writeToStore(final DataTree store, final YangInstanceIdentifier id,
DataTreeModification modification = store.getDataTree().takeSnapshot().newModification();
batched.apply(modification);
- store.notifyListeners(store.commit(modification));
+ store.notifyListeners(commitTransaction(store.getDataTree(), modification));
}
DataTree setupInMemorySnapshotStore() throws DataValidationFailedException {
return mockCandidate;
}
- static void commitTransaction(final DataTree store, final DataTreeModification modification)
+ static DataTreeCandidate commitTransaction(final DataTree store, final DataTreeModification modification)
throws DataValidationFailedException {
modification.ready();
store.validate(modification);
- store.commit(store.prepare(modification));
+ final DataTreeCandidate candidate = store.prepare(modification);
+ store.commit(candidate);
+ return candidate;
}
@SuppressWarnings("serial")
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
import org.slf4j.Logger;
static void commit(ShardDataTree shardDataTree, DataTreeModification modification)
throws DataValidationFailedException {
- shardDataTree.notifyListeners(shardDataTree.commit(modification));
+ modification.ready();
+ shardDataTree.getDataTree().validate(modification);
+ final DataTreeCandidate candidate = shardDataTree.getDataTree().prepare(modification);
+ shardDataTree.getDataTree().commit(candidate);
+ shardDataTree.notifyListeners(candidate);
}
static DOMEntityOwnershipChange ownershipChange(final DOMEntity expEntity, final boolean expWasOwner,