/** {@inheritDoc} */ @Override public boolean isRollbackOnly() { enter(); try { if (async) save(tx.isRollbackOnly()); return tx.isRollbackOnly(); } finally { leave(); } }
/** * Commits active transaction if exists. * * @throws IgniteCheckedException If failed. */ private void finishActiveTxIfNecessary() throws IgniteCheckedException { try (GridNearTxLocal tx = MvccUtils.tx(ctx)) { if (tx == null) return; if (!tx.isRollbackOnly()) tx.commit(); else tx.rollback(); } }
if (isRollbackOnly()) return new GridFinishedFuture<>(timedOut() ? timeoutException() : rollbackException());
@Override public Map<K, V> apply(Void v, Exception e) { if (e != null) { setRollbackOnly(); throw new GridClosureException(e); } if (isRollbackOnly()) { if (timedOut()) throw new GridClosureException(new IgniteTxTimeoutCheckedException( "Transaction has been timed out: " + GridNearTxLocal.this)); else throw new GridClosureException(new IgniteTxRollbackCheckedException( "Transaction has been rolled back: " + GridNearTxLocal.this)); } return map; } },
if (isRollbackOnly()) return new GridFinishedFuture<>(timedOut() ? timeoutException() : rollbackException());
/** {@inheritDoc} */ @Override public void prepare() { if (!tx.state(PREPARING)) { if (tx.isRollbackOnly() || tx.setRollbackOnly()) { if (tx.remainingTime() == -1) onDone(tx.timeoutException()); else onDone(tx.rollbackException()); } else onDone(new IgniteCheckedException("Invalid transaction state for prepare " + "[state=" + tx.state() + ", tx=" + this + ']')); return; } try { tx.userPrepare(Collections.<IgniteTxEntry>emptyList()); cctx.mvcc().addFuture(this); preparePessimistic(); } catch (IgniteCheckedException e) { onDone(e); } }
throw isRollbackOnly() ? timedOut() ? timeoutException() : rollbackException() : new IgniteCheckedException("Invalid transaction state for commit [state=" + state() + ", tx=" + this + ']'); if (commit && !isRollbackOnly()) userCommit(); else if (!isRollbackOnly()) { invalidate = true;
return new GridFinishedFuture<>(timeoutException()); if (isRollbackOnly()) return new GridFinishedFuture<>(rollbackException());
return new GridFinishedFuture<>(timeoutException()); if (isRollbackOnly()) return new GridFinishedFuture<>(rollbackException());
if (tx.isRollbackOnly() || tx.setRollbackOnly()) { if (tx.remainingTime() == -1) onDone(tx.timeoutException());
if (isRollbackOnly()) return new GridFinishedFuture<>(timedOut() ? timeoutException() : rollbackException());
/** * Initializes future. * * @param remap Remap flag. */ @Override protected void prepare0(boolean remap, boolean topLocked) { boolean txStateCheck = remap ? tx.state() == PREPARING : tx.state(PREPARING); if (!txStateCheck) { if (tx.isRollbackOnly() || tx.setRollbackOnly()) { if (tx.timedOut()) onDone(null, tx.timeoutException()); else onDone(null, tx.rollbackException()); } else onDone(null, new IgniteCheckedException("Invalid transaction state for " + "prepare [state=" + tx.state() + ", tx=" + this + ']')); return; } boolean set = cctx.tm().setTxTopologyHint(tx.topologyVersionSnapshot()); try { prepare(tx.readEntries(), tx.writeEntries(), remap, topLocked); markInitialized(); } finally { if (set) cctx.tm().setTxTopologyHint(null); } }
return new GridFinishedFuture<>(timeoutException()); if (isRollbackOnly()) return new GridFinishedFuture<>(rollbackException());
if (isRollbackOnly()) throw timedOut() ? timeoutException() : rollbackException();
if (isRollbackOnly()) return finishFuture(enlistFut, timedOut() ? timeoutException() : rollbackException(), false);
/** {@inheritDoc} */ @Override public boolean isRollbackOnly() { enter(); try { if (async) save(tx.isRollbackOnly()); return tx.isRollbackOnly(); } finally { leave(); } }
/** * Commits active transaction if exists. * * @throws IgniteCheckedException If failed. */ private void finishActiveTxIfNecessary() throws IgniteCheckedException { try (GridNearTxLocal tx = MvccUtils.tx(ctx)) { if (tx == null) return; if (!tx.isRollbackOnly()) tx.commit(); else tx.rollback(); } }
@Override public Map<K, V> apply(Void v, Exception e) { if (e != null) { setRollbackOnly(); throw new GridClosureException(e); } if (isRollbackOnly()) { if (timedOut()) throw new GridClosureException(new IgniteTxTimeoutCheckedException( "Transaction has been timed out: " + GridNearTxLocal.this)); else throw new GridClosureException(new IgniteTxRollbackCheckedException( "Transaction has been rolled back: " + GridNearTxLocal.this)); } return map; } },
/** {@inheritDoc} */ @Override public void prepare() { if (!tx.state(PREPARING)) { if (tx.isRollbackOnly() || tx.setRollbackOnly()) { if (tx.remainingTime() == -1) onDone(tx.timeoutException()); else onDone(tx.rollbackException()); } else onDone(new IgniteCheckedException("Invalid transaction state for prepare " + "[state=" + tx.state() + ", tx=" + this + ']')); return; } try { tx.userPrepare(Collections.<IgniteTxEntry>emptyList()); cctx.mvcc().addFuture(this); preparePessimistic(); } catch (IgniteCheckedException e) { onDone(e); } }
if (tx.isRollbackOnly() || tx.setRollbackOnly()) { if (tx.remainingTime() == -1) onDone(tx.timeoutException());