@Override public void abortTransaction() { if (transactionState == TransactionState.ABORTED) { throw new IllegalStateException("Cannot call abortTransaction twice"); } if (transactionState == TransactionState.COMMITTED) { throw new IllegalStateException("Cannot call abortTransaction after calling commitTransaction"); } if (transactionState == TransactionState.NONE) { throw new IllegalStateException("There is no transaction started"); } try { if (messageSentInCurrentTransaction) { ReadConcern readConcern = transactionOptions.getReadConcern(); if (readConcern == null) { throw new MongoInternalException("Invariant violated. Transaction options read concern can not be null"); } delegate.getOperationExecutor().execute(new AbortTransactionOperation(transactionOptions.getWriteConcern()), readConcern, this); } } catch (Exception e) { // ignore errors } finally { cleanupTransaction(TransactionState.ABORTED); } }
@Override public void abortTransaction() { if (transactionState == TransactionState.ABORTED) { throw new IllegalStateException("Cannot call abortTransaction twice"); } if (transactionState == TransactionState.COMMITTED) { throw new IllegalStateException("Cannot call abortTransaction after calling commitTransaction"); } if (transactionState == TransactionState.NONE) { throw new IllegalStateException("There is no transaction started"); } try { if (messageSentInCurrentTransaction) { ReadConcern readConcern = transactionOptions.getReadConcern(); if (readConcern == null) { throw new MongoInternalException("Invariant violated. Transaction options read concern can not be null"); } delegate.getOperationExecutor().execute(new AbortTransactionOperation(transactionOptions.getWriteConcern()), readConcern, this); } } catch (Exception e) { // ignore errors } finally { cleanupTransaction(TransactionState.ABORTED); } }
@Override public void abortTransaction() { if (transactionState == TransactionState.ABORTED) { throw new IllegalStateException("Cannot call abortTransaction twice"); } if (transactionState == TransactionState.COMMITTED) { throw new IllegalStateException("Cannot call abortTransaction after calling commitTransaction"); } if (transactionState == TransactionState.NONE) { throw new IllegalStateException("There is no transaction started"); } try { if (messageSentInCurrentTransaction) { ReadConcern readConcern = transactionOptions.getReadConcern(); if (readConcern == null) { throw new MongoInternalException("Invariant violated. Transaction options read concern can not be null"); } delegate.getOperationExecutor().execute(new AbortTransactionOperation(transactionOptions.getWriteConcern()), readConcern, this); } } catch (Exception e) { // ignore errors } finally { cleanupTransaction(TransactionState.ABORTED); } }