/** * Suspends transaction. It could be resumed later. Supported only for optimistic transactions. * * @throws IgniteCheckedException If the transaction is in an incorrect state, or timed out. */ public void suspend() throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Suspend near local tx: " + this); if (pessimistic()) throw new UnsupportedOperationException("Suspension is not supported for pessimistic transactions."); if (threadId() != Thread.currentThread().getId()) throw new IgniteCheckedException("Only thread started transaction can suspend it."); synchronized (this) { checkValid(); cctx.tm().suspendTx(this); } }
/** * Resumes transaction (possibly in another thread) if it was previously suspended. * * @param checkTimeout Whether timeout should be checked. * @param threadId Thread id to restore. * @throws IgniteCheckedException If the transaction is in an incorrect state, or timed out. */ private void resume(boolean checkTimeout, long threadId) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Resume near local tx: " + this); if (pessimistic()) throw new UnsupportedOperationException("Resume is not supported for pessimistic transactions."); synchronized (this) { checkValid(checkTimeout); cctx.tm().resumeTx(this, threadId); } }
/** * @param cacheCtx Cache context. * @param retval Return value flag. * @param mvccOp SQL operation flag. * @throws IgniteCheckedException If failed. */ private void beforeRemove(GridCacheContext cacheCtx, boolean retval, boolean mvccOp) throws IgniteCheckedException { assert !mvccOp || cacheCtx.mvccEnabled(); checkUpdatesAllowed(cacheCtx); cacheCtx.checkSecurity(SecurityPermission.CACHE_REMOVE); if (cacheCtx.mvccEnabled() && !isOperationAllowed(mvccOp)) throw new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG); if (retval) needReturnValue(true); checkValid(); }
/** * @param cacheCtx Cache context. * @param retval Return value flag. * @param mvccOp SQL operation flag. * @throws IgniteCheckedException If failed. */ private void beforePut(GridCacheContext cacheCtx, boolean retval, boolean mvccOp) throws IgniteCheckedException { assert !mvccOp || cacheCtx.mvccEnabled(); checkUpdatesAllowed(cacheCtx); cacheCtx.checkSecurity(SecurityPermission.CACHE_PUT); if (cacheCtx.mvccEnabled() && !isOperationAllowed(mvccOp)) throw new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG); if (retval) needReturnValue(true); checkValid(); init(); }
/** * Suspends transaction. It could be resumed later. Supported only for optimistic transactions. * * @throws IgniteCheckedException If the transaction is in an incorrect state, or timed out. */ public void suspend() throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Suspend near local tx: " + this); if (pessimistic()) throw new UnsupportedOperationException("Suspension is not supported for pessimistic transactions."); if (threadId() != Thread.currentThread().getId()) throw new IgniteCheckedException("Only thread started transaction can suspend it."); synchronized (this) { checkValid(); cctx.tm().suspendTx(this); } }
/** * Resumes transaction (possibly in another thread) if it was previously suspended. * * @param checkTimeout Whether timeout should be checked. * @param threadId Thread id to restore. * @throws IgniteCheckedException If the transaction is in an incorrect state, or timed out. */ private void resume(boolean checkTimeout, long threadId) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Resume near local tx: " + this); if (pessimistic()) throw new UnsupportedOperationException("Resume is not supported for pessimistic transactions."); synchronized (this) { checkValid(checkTimeout); cctx.tm().resumeTx(this, threadId); } }
/** * @param cacheCtx Cache context. * @param retval Return value flag. * @param mvccOp SQL operation flag. * @throws IgniteCheckedException If failed. */ private void beforeRemove(GridCacheContext cacheCtx, boolean retval, boolean mvccOp) throws IgniteCheckedException { assert !mvccOp || cacheCtx.mvccEnabled(); checkUpdatesAllowed(cacheCtx); cacheCtx.checkSecurity(SecurityPermission.CACHE_REMOVE); if (cacheCtx.mvccEnabled() && !isOperationAllowed(mvccOp)) throw new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG); if (retval) needReturnValue(true); checkValid(); }
/** * @param cacheCtx Cache context. * @param retval Return value flag. * @param mvccOp SQL operation flag. * @throws IgniteCheckedException If failed. */ private void beforePut(GridCacheContext cacheCtx, boolean retval, boolean mvccOp) throws IgniteCheckedException { assert !mvccOp || cacheCtx.mvccEnabled(); checkUpdatesAllowed(cacheCtx); cacheCtx.checkSecurity(SecurityPermission.CACHE_PUT); if (cacheCtx.mvccEnabled() && !isOperationAllowed(mvccOp)) throw new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG); if (retval) needReturnValue(true); checkValid(); init(); }