use of org.corfudb.runtime.exceptions.NetworkException in project CorfuDB by CorfuDB.
the class CorfuCompileProxy method abortTransaction.
private void abortTransaction(Exception e) {
long snapshot_timestamp;
AbortCause abortCause;
AbstractTransactionalContext context = TransactionalContext.getCurrentContext();
if (e instanceof NetworkException) {
// If a 'NetworkException' was received within a transactional context, an attempt to
// 'getSnapshotTimestamp' will also fail (as it requests it to the Sequencer). A new NetworkException
// would prevent the earliest to be propagated and encapsulated as a TransactionAbortedException.
snapshot_timestamp = -1L;
abortCause = AbortCause.NETWORK;
} else {
snapshot_timestamp = context.getSnapshotTimestamp();
abortCause = AbortCause.UNDEFINED;
}
TxResolutionInfo txInfo = new TxResolutionInfo(context.getTransactionID(), snapshot_timestamp);
TransactionAbortedException tae = new TransactionAbortedException(txInfo, null, abortCause);
context.abortTransaction(tae);
TransactionalContext.removeContext();
throw tae;
}
Aggregations