/** * Checks transaction expiration. * * @param checkTimeout Whether timeout should be checked. * @throws IgniteCheckedException If transaction check failed. */ protected void checkValid(boolean checkTimeout) throws IgniteCheckedException { if (local() && !dht() && remainingTime() == -1 && checkTimeout) state(MARKED_ROLLBACK, true); if (isRollbackOnly()) { if (remainingTime() == -1) throw new IgniteTxTimeoutCheckedException("Cache transaction timed out: " + CU.txString(this)); TransactionState state = state(); if (state == ROLLING_BACK || state == ROLLED_BACK) throw new IgniteTxRollbackCheckedException("Cache transaction is marked as rollback-only " + "(will be rolled back automatically): " + this); if (state == UNKNOWN) throw new IgniteTxHeuristicCheckedException("Cache transaction is in unknown state " + "(remote transactions will be invalidated): " + this); throw rollbackException(); } }
assert cached.detached() || cached.lockedByThread(threadId) || isRollbackOnly() : "Transaction lock is not acquired [entry=" + cached + ", tx=" + this + ", nodeId=" + cctx.localNodeId() + ", threadId=" + threadId + ']';
/** * Checks transaction expiration. * * @param checkTimeout Whether timeout should be checked. * @throws IgniteCheckedException If transaction check failed. */ protected void checkValid(boolean checkTimeout) throws IgniteCheckedException { if (local() && !dht() && remainingTime() == -1 && checkTimeout) state(MARKED_ROLLBACK, true); if (isRollbackOnly()) { if (remainingTime() == -1) throw new IgniteTxTimeoutCheckedException("Cache transaction timed out: " + CU.txString(this)); TransactionState state = state(); if (state == ROLLING_BACK || state == ROLLED_BACK) throw new IgniteTxRollbackCheckedException("Cache transaction is marked as rollback-only " + "(will be rolled back automatically): " + this); if (state == UNKNOWN) throw new IgniteTxHeuristicCheckedException("Cache transaction is in unknown state " + "(remote transactions will be invalidated): " + this); throw rollbackException(); } }
assert cached.detached() || cached.lockedByThread(threadId) || isRollbackOnly() : "Transaction lock is not acquired [entry=" + cached + ", tx=" + this + ", nodeId=" + cctx.localNodeId() + ", threadId=" + threadId + ']';