/** {@inheritDoc} */ @Override public boolean setTransactionTimeout(int i) { cacheTx.timeout(i * 1000); return true; }
trackTimeout = timeout() > 0 && !implicit() && cctx.time().addTimeoutObject(this);
/** {@inheritDoc} */ @Override public long timeout(long timeout) { return tx.timeout(timeout); }
/** {@inheritDoc} */ @Override public int getTransactionTimeout() { return (int)(cacheTx.timeout() / 1000); }
/** {@inheritDoc} */ @Override public long endTime() { return startTime() + timeout(); }
/** {@inheritDoc} */ @Override public final void onNearTxLocalTimeout() { if (keyLockFut != null && !keyLockFut.isDone()) { ERR_UPD.compareAndSet(this, null, new IgniteTxTimeoutCheckedException("Failed to acquire lock " + "within provided timeout for transaction [timeout=" + tx.timeout() + ", tx=" + tx + ']')); keyLockFut.onDone(); } }
/** {@inheritDoc} */ @Override public long timeout(long timeout) { long old = super.timeout(timeout); if (old == timeout) return old; if (trackTimeout) { if (!cctx.time().removeTimeoutObject(this)) return old; // Do nothing, because transaction is started to roll back. } if (timeout() > 0) // Method can be called only for explicit transactions. trackTimeout = cctx.time().addTimeoutObject(this); return old; }
@Override public GridNearTxPrepareResponse apply(TxDeadlock deadlock, Exception e) { if (e != null) U.warn(log, "Failed to detect deadlock.", e); else { e = new IgniteTxTimeoutCheckedException("Failed to acquire lock within provided timeout for " + "transaction [timeout=" + tx.timeout() + ", tx=" + CU.txString(tx) + ']', deadlock != null ? new TransactionDeadlockException(deadlock.toString(cctx)) : null); if (!ERR_UPD.compareAndSet(GridNearOptimisticTxPrepareFuture.this, null, e) && err instanceof IgniteTxTimeoutCheckedException) { err = e; } } onDone(null, e); return null; } }, cctx.tm().detectDeadlock(tx, keys)));
@Override public void apply(IgniteInternalFuture<TxDeadlock> fut) { try { TxDeadlock deadlock = fut.get(); err = new IgniteTxTimeoutCheckedException("Failed to acquire lock within provided " + "timeout for transaction [timeout=" + tx.timeout() + ", tx=" + CU.txString(tx) + ']', deadlock != null ? new TransactionDeadlockException(deadlock.toString(cctx.shared())) : null); } catch (IgniteCheckedException e) { err = e; U.warn(log, "Failed to detect deadlock.", e); } synchronized (LockTimeoutObject.this) { onComplete(false, true); } } });
@Override public void apply(IgniteInternalFuture<TxDeadlock> fut) { try { TxDeadlock deadlock = fut.get(); err = new IgniteTxTimeoutCheckedException("Failed to acquire lock within provided " + "timeout for transaction [timeout=" + tx.timeout() + ", tx=" + CU.txString(tx) + ']', deadlock != null ? new TransactionDeadlockException(deadlock.toString(cctx.shared())) : null); } catch (IgniteCheckedException e) { err = e; U.warn(log, "Failed to detect deadlock.", e); } synchronized (LockTimeoutObject.this) { onComplete(false, true); } } });
"within provided timeout for transaction [timeout=" + tx.timeout() + ", tx=" + tx + ']'));
/** * @param cctx Context. * @param tx Transaction. */ protected GridNearOptimisticTxPrepareFutureAdapter(GridCacheSharedContext cctx, GridNearTxLocal tx) { super(cctx, tx); assert tx.optimistic() : tx; if (tx.timeout() > 0) { // Init keyLockFut to make sure it is created when {@link #onNearTxLocalTimeout} is called. for (IgniteTxEntry e : tx.writeEntries()) { if (e.context().isNear() || e.context().isLocal()) { keyLockFut = new KeyLockFuture(); break; } } if (tx.serializable() && keyLockFut == null) { for (IgniteTxEntry e : tx.readEntries()) { if (e.context().isNear() || e.context().isLocal()) { keyLockFut = new KeyLockFuture(); break; } } } if (keyLockFut != null) add((IgniteInternalFuture)keyLockFut); } }
/** {@inheritDoc} */ @Override public boolean setTransactionTimeout(int i) { cacheTx.timeout(i * 1000); return true; }
/** {@inheritDoc} */ @Override public long timeout(long timeout) { return tx.timeout(timeout); }
/** {@inheritDoc} */ @Override public int getTransactionTimeout() { return (int)(cacheTx.timeout() / 1000); }
/** {@inheritDoc} */ @Override public long endTime() { return startTime() + timeout(); }
/** {@inheritDoc} */ @Override public final void onNearTxLocalTimeout() { if (keyLockFut != null && !keyLockFut.isDone()) { ERR_UPD.compareAndSet(this, null, new IgniteTxTimeoutCheckedException("Failed to acquire lock " + "within provided timeout for transaction [timeout=" + tx.timeout() + ", tx=" + tx + ']')); keyLockFut.onDone(); } }
/** {@inheritDoc} */ @Override public long timeout(long timeout) { long old = super.timeout(timeout); if (old == timeout) return old; if (trackTimeout) { if (!cctx.time().removeTimeoutObject(this)) return old; // Do nothing, because transaction is started to roll back. } if (timeout() > 0) // Method can be called only for explicit transactions. trackTimeout = cctx.time().addTimeoutObject(this); return old; }