use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class FlowNodeReconciliationImpl method deleteDSStaleMeters.
private void deleteDSStaleMeters(List<InstanceIdentifier<StaleMeter>> metersForBulkDelete) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (InstanceIdentifier<StaleMeter> staleMeterIId : metersForBulkDelete) {
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleMeterIId);
}
CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
handleStaleEntityDeletionResultFuture(submitFuture);
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class TransactionChainManagerTest method testSubmitTransactionFailed.
@Test
public void testSubmitTransactionFailed() throws Exception {
Mockito.when(writeTx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
final Node data = new NodeBuilder().setId(nodeId).build();
txChainManager.initialSubmitWriteTransaction();
txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
txChainManager.submitTransaction();
Mockito.verify(txChain).newReadWriteTransaction();
Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
Mockito.verify(writeTx).submit();
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project controller by opendaylight.
the class SimpletxBaDelete method executeList.
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
long putCnt = 0;
for (long l = 0; l < outerListElem; l++) {
InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class).child(OuterList.class, new OuterListKey((int) l));
tx.delete(dsType, iid);
putCnt++;
if (putCnt == writesPerTx) {
try {
tx.submit().checkedGet();
txOk++;
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed: {}", e);
txError++;
}
tx = dataBroker.newWriteOnlyTransaction();
putCnt = 0;
}
}
if (putCnt != 0) {
try {
tx.submit().checkedGet();
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed: {}", e);
}
}
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project controller by opendaylight.
the class SimpletxDomDelete method executeList.
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
final org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
final YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
DOMDataWriteTransaction tx = domDataBroker.newWriteOnlyTransaction();
long writeCnt = 0;
for (int l = 0; l < outerListElem; l++) {
YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
tx.delete(dsType, yid);
writeCnt++;
if (writeCnt == writesPerTx) {
try {
tx.submit().checkedGet();
txOk++;
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed: {}", e);
txError++;
}
tx = domDataBroker.newWriteOnlyTransaction();
writeCnt = 0;
}
}
if (writeCnt != 0) {
try {
tx.submit().checkedGet();
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed: {}", e);
}
}
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project controller by opendaylight.
the class SimpletxDomWrite method executeList.
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
final YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
DOMDataWriteTransaction tx = domDataBroker.newWriteOnlyTransaction();
long writeCnt = 0;
for (MapEntryNode element : this.list) {
YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
if (oper == StartTestInput.Operation.PUT) {
tx.put(dsType, yid, element);
} else {
tx.merge(dsType, yid, element);
}
writeCnt++;
if (writeCnt == writesPerTx) {
try {
tx.submit().checkedGet();
txOk++;
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed", e);
txError++;
}
tx = domDataBroker.newWriteOnlyTransaction();
writeCnt = 0;
}
}
if (writeCnt != 0) {
try {
tx.submit().checkedGet();
} catch (final TransactionCommitFailedException e) {
LOG.error("Transaction failed", e);
}
}
}
Aggregations