use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project genius by opendaylight.
the class MDSALManager method removeFlowInternal.
public CheckedFuture<Void, TransactionCommitFailedException> removeFlowInternal(FlowEntity flowEntity) {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
deleteFlowEntityInternal(flowEntity, tx);
CheckedFuture<Void, TransactionCommitFailedException> submitFuture = tx.submit();
Futures.addCallback(submitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
// Committed successfully
LOG.debug("Delete Flow -- Committedsuccessfully ");
}
@Override
public void onFailure(final Throwable throwable) {
// Transaction failed
if (throwable instanceof OptimisticLockFailedException) {
// Failed because of concurrent transaction modifying same
// data
LOG.error("Delete Flow -- Failed because of concurrent transaction modifying same data");
} else {
// Some other type of TransactionCommitFailedException
LOG.error("Delete Flow -- Some other type of TransactionCommitFailedException", throwable);
}
}
});
return submitFuture;
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project genius by opendaylight.
the class DataBrokerFailuresImpl method failButSubmitsAnyways.
@Override
public void failButSubmitsAnyways() {
unfailSubmits();
this.submitException = new TransactionCommitFailedException("caused by simulated AskTimeoutException");
this.submitAndThrowException = true;
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method deleteGroup.
private void deleteGroup(final CommandInterpreter ci, Group group, Group group1) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(group.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path1);
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(group1.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class OpenflowpluginMeterTestCommandProvider method _removeMeter.
public void _removeMeter(final CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
ci.println("test node added");
createTestNode();
} else {
ci.println("User node added" + nref);
createUserNode(nref);
}
createTestMeter();
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(testMeter.getMeterId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class OpenflowpluginMeterTestCommandProvider method writeMeter.
private void writeMeter(final CommandInterpreter ci, Meter meter, Meter meter1) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, meter, true);
InstanceIdentifier<Meter> path2 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter1.getMeterId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path2, meter1, true);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
Aggregations