use of org.opendaylight.controller.md.sal.dom.spi.ForwardingDOMDataReadWriteTransaction in project controller by opendaylight.
the class PingPongTransactionChain method newReadWriteTransaction.
@Override
public DOMDataReadWriteTransaction newReadWriteTransaction() {
final PingPongTransaction tx = allocateTransaction();
final DOMDataReadWriteTransaction ret = new ForwardingDOMDataReadWriteTransaction() {
private boolean isOpen = true;
@Override
protected DOMDataReadWriteTransaction delegate() {
return tx.getTransaction();
}
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
readyTransaction(tx);
isOpen = false;
return tx.getSubmitFuture();
}
@Override
public boolean cancel() {
if (isOpen) {
cancelTransaction(tx, this);
isOpen = false;
return true;
} else {
return false;
}
}
};
tx.recordFrontendTransaction(ret);
return ret;
}
Aggregations