private void checkTimeout() { if (startTime + options.getTimeoutMillis() < Clock.currentTimeMillis()) { throw new TransactionException("Transaction is timed-out!"); } }
private void checkTimeout() { if (startTime + options.getTimeoutMillis() < Clock.currentTimeMillis()) { throw new TransactionException("Transaction is timed-out!"); } }
void begin() { try { if (client.getConnectionManager().getOwnerConnection() == null) { throw new TransactionException("Owner connection needs to be present to begin a transaction"); } if (state == ACTIVE) { throw new IllegalStateException("Transaction is already active"); } checkThread(); if (TRANSACTION_EXISTS.get() != null) { throw new IllegalStateException("Nested transactions are not allowed!"); } TRANSACTION_EXISTS.set(Boolean.TRUE); startTime = Clock.currentTimeMillis(); ClientMessage request = TransactionCreateCodec.encodeRequest(options.getTimeoutMillis(), options.getDurability(), options.getTransactionType().id(), threadId); ClientMessage response = ClientTransactionUtil.invoke(request, getTxnId(), client, connection); TransactionCreateCodec.ResponseParameters result = TransactionCreateCodec.decodeResponse(response); txnId = result.response; state = ACTIVE; } catch (Exception e) { TRANSACTION_EXISTS.set(null); throw rethrow(e); } }
void begin() { try { if (client.getConnectionManager().getOwnerConnection() == null) { throw new TransactionException("Owner connection needs to be present to begin a transaction"); } if (state == ACTIVE) { throw new IllegalStateException("Transaction is already active"); } checkThread(); if (TRANSACTION_EXISTS.get() != null) { throw new IllegalStateException("Nested transactions are not allowed!"); } TRANSACTION_EXISTS.set(Boolean.TRUE); startTime = Clock.currentTimeMillis(); ClientMessage request = TransactionCreateCodec.encodeRequest(options.getTimeoutMillis(), options.getDurability(), options.getTransactionType().id(), threadId); ClientMessage response = ClientTransactionUtil.invoke(request, getTxnId(), client, connection); TransactionCreateCodec.ResponseParameters result = TransactionCreateCodec.decodeResponse(response); txnId = result.response; state = ACTIVE; } catch (Exception e) { TRANSACTION_EXISTS.set(null); throw rethrow(e); } }
public TransactionImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngine nodeEngine, TransactionOptions options, String txOwnerUuid, boolean originatedFromClient) { this.transactionLog = new TransactionLog(); this.transactionManagerService = transactionManagerService; this.nodeEngine = nodeEngine; this.txnId = newUnsecureUuidString(); this.timeoutMillis = options.getTimeoutMillis(); this.transactionType = options.getTransactionType() == LOCAL ? ONE_PHASE : options.getTransactionType(); this.durability = transactionType == ONE_PHASE ? 0 : options.getDurability(); this.txOwnerUuid = txOwnerUuid == null ? nodeEngine.getLocalMember().getUuid() : txOwnerUuid; this.checkThreadAccess = txOwnerUuid == null; this.logger = nodeEngine.getLogger(getClass()); this.rollbackExceptionHandler = logAllExceptions(logger, "Error during rollback!", Level.FINEST); this.rollbackTxExceptionHandler = logAllExceptions(logger, "Error during tx rollback backup!", Level.FINEST); this.replicationTxExceptionHandler = createReplicationTxExceptionHandler(logger); this.originatedFromClient = originatedFromClient; }
public TransactionImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngine nodeEngine, TransactionOptions options, String txOwnerUuid, boolean originatedFromClient) { this.transactionLog = new TransactionLog(); this.transactionManagerService = transactionManagerService; this.nodeEngine = nodeEngine; this.txnId = newUnsecureUuidString(); this.timeoutMillis = options.getTimeoutMillis(); this.transactionType = options.getTransactionType() == LOCAL ? ONE_PHASE : options.getTransactionType(); this.durability = transactionType == ONE_PHASE ? 0 : options.getDurability(); this.txOwnerUuid = txOwnerUuid == null ? nodeEngine.getLocalMember().getUuid() : txOwnerUuid; this.checkThreadAccess = txOwnerUuid == null; this.logger = nodeEngine.getLogger(getClass()); this.rollbackExceptionHandler = logAllExceptions(logger, "Error during rollback!", Level.FINEST); this.rollbackTxExceptionHandler = logAllExceptions(logger, "Error during tx rollback backup!", Level.FINEST); this.replicationTxExceptionHandler = createReplicationTxExceptionHandler(logger); this.originatedFromClient = originatedFromClient; }
long timeoutMillis = TransactionOptions.getDefault().getTimeoutMillis(); waitWithDeadline(futures, timeoutMillis, TimeUnit.MILLISECONDS, finalizeExceptionHandler); } else {
long timeoutMillis = TransactionOptions.getDefault().getTimeoutMillis(); waitWithDeadline(futures, timeoutMillis, TimeUnit.MILLISECONDS, finalizeExceptionHandler); } else {
lockClusterStateOnAllMembers(stateChange, nodeEngine, options.getTimeoutMillis(), txnId, members, memberListVersion, partitionStateVersion);
lockClusterStateOnAllMembers(stateChange, nodeEngine, options.getTimeoutMillis(), txnId, members, memberListVersion, partitionStateVersion);