import org.opendaylight.mdsal.dom.api.DOMDataTreeReadOperations;
import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
+import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
}
/**
- * Process edit operations of one {@link PatchContext}.
+ * Process edit operations of one {@link PatchContext}. Close {@link DOMTransactionChain} inside of object
+ * {@link TransactionVarsWrapper} provided as a parameter.
* @param context Patch context to be processed
* @param transactionNode Wrapper for transaction
* @param schemaContextRef Soft reference for global schema context
final SchemaContextRef schemaContextRef) {
final List<PatchStatusEntity> editCollection = new ArrayList<>();
boolean noError = true;
- final DOMDataTreeReadWriteTransaction tx = transactionNode.getTransactionChain().newReadWriteTransaction();
+ final DOMTransactionChain transactionChain = transactionNode.getTransactionChain();
+ final DOMDataTreeReadWriteTransaction tx = transactionChain.newReadWriteTransaction();
for (final PatchEntity patchEntity : context.getData()) {
if (noError) {
final FluentFuture<? extends CommitInfo> future = tx.commit();
try {
- FutureCallbackTx.addCallback(future, PatchData.PATCH_TX_TYPE, response);
+ //This method will close transactionChain
+ FutureCallbackTx.addCallback(future, PatchData.PATCH_TX_TYPE, response, transactionChain);
} catch (final RestconfDocumentedException e) {
// if errors occurred during transaction commit then patch failed and global errors are reported
return new PatchStatusContext(context.getPatchId(), ImmutableList.copyOf(editCollection), false,
return new PatchStatusContext(context.getPatchId(), ImmutableList.copyOf(editCollection), true, null);
} else {
tx.cancel();
- transactionNode.getTransactionChainHandler().reset();
+ transactionChain.close();
return new PatchStatusContext(context.getPatchId(), ImmutableList.copyOf(editCollection),
false, null);
}
* @param dataStore Datastore to write data to
* @param path Path for data to be created
* @param payload Data to be created
- * @param rWTransaction Transaction
+ * @param rwTransaction Transaction
* @param schemaContextRef Soft reference for global schema context
*/
private static void createDataWithinTransaction(final LogicalDatastoreType dataStore,