/** * Creates a new default configured TransactionsOptions. * <p/> * It will be configured with a timeout of 2 minutes, durability of 1 and a TransactionType.TWO_PHASE. */ public TransactionOptions() { setDurability(1).setTransactionType(TransactionType.TWO_PHASE).setDefaultTimeout(); }
@Override public Throwable createException(String message, Throwable cause) { return new TransactionException(message, cause); } });
/** * @see TransactionContext#beginTransaction() */ public void beginTransaction() { transactionContext.beginTransaction(); transactionActive = true; }
@Override public void rollback() { if (this.transaction != null) { this.transaction.rollbackTransaction(); } }
private void commit() { transactionContext.commitTransaction(); transactionContext = null; transactionalMap = null; } }
/** * Creates a new TransactionOptions configured with default settings. * * @return the created default TransactionOptions. * @see #TransactionOptions() */ public static TransactionOptions getDefault() { return new TransactionOptions(); }
private void checkTimeout() { if (startTime + options.getTimeoutMillis() < Clock.currentTimeMillis()) { throw new TransactionException("Transaction is timed-out!"); } }
@Override public Throwable createException(String message, Throwable cause) { return new TransactionTimedOutException(message, cause); } });
@Override public Throwable createException(String message, Throwable cause) { return new TransactionNotActiveException(message); } });
/** * @see TransactionContext#beginTransaction() */ public void beginTransaction() { transactionContext.beginTransaction(); transactionActive = true; }
@Override public void rollback() { context.rollbackTransaction(); } }
private void commit() { transactionContext.commitTransaction(); transactionContext = null; transactionalMap = null; } }
/** * Creates a new default configured TransactionsOptions. * <p/> * It will be configured with a timeout of 2 minutes, durability of 1 and a TransactionType.TWO_PHASE. */ public TransactionOptions() { setDurability(1).setTransactionType(TransactionType.TWO_PHASE).setDefaultTimeout(); }
/** * Creates a new TransactionOptions configured with default settings. * * @return the created default TransactionOptions. * @see #TransactionOptions() */ public static TransactionOptions getDefault() { return new TransactionOptions(); }
@Override public RuntimeException create(Throwable throwable, String message) { return new TransactionException(message, throwable); } };
@Override public Throwable createException(String message, Throwable cause) { return new TransactionTimedOutException(message, cause); } });
@Override public Throwable createException(String message, Throwable cause) { return new TransactionNotActiveException(message); } });
/** * @see TransactionContext#beginTransaction() */ public void beginTransaction() { transactionContext.beginTransaction(); transactionActive = true; }
@Override public Throwable createException(String message, Throwable cause) { return new TransactionException(message, cause); } });
@Override public RuntimeException create(Throwable throwable, String message) { return new TransactionException(message, throwable); } };