/** * @param tx Tx proxy. */ public TransactionEventProxyImpl(GridNearTxLocal tx) { assert tx != null; this.tx = tx; this.xid = tx.xid(); }
/** {@inheritDoc} */ @Override public IgniteUuid timeoutId() { return xid(); }
/** {@inheritDoc} */ @Override public IgniteUuid xid() { return tx.xid(); }
/** * @param duration Duration. */ private Map<String, String> getNearTxs(long duration) { final Collection<GridNearTxLocal> txs = nearTxs(duration); final HashMap<String, String> res = new HashMap<>(txs.size()); for (GridNearTxLocal tx : txs) res.put(tx.xid().toString(), composeTx(tx)); return res; }
/** {@inheritDoc} */ @Override public void beforeCompletion() { if (log.isDebugEnabled()) log.debug("Synchronization.beforeCompletion() [xid=" + cacheTx.xid() + "]"); if (cacheTx.state() != ACTIVE) throw new CacheException("Cache transaction is not in active state."); try { cacheTx.prepare(true); } catch (IgniteCheckedException e) { throw new CacheException("Failed to prepare cache transaction.", e); } }
/** {@inheritDoc} */ @Override public void afterCompletion(int status) { switch (status) { case Status.STATUS_COMMITTED: if (log.isDebugEnabled()) log.debug("Synchronization.afterCompletion(STATUS_COMMITTED) [xid=" + cacheTx.xid() + "]"); try { ctx.cache().context().commitTxAsync(cacheTx).get(); } catch (IgniteCheckedException e) { throw new CacheException("Failed to commit cache transaction.", e); } break; case Status.STATUS_ROLLEDBACK: if (log.isDebugEnabled()) log.debug("Synchronization.afterCompletion(STATUS_ROLLEDBACK) [xid=" + cacheTx.xid() + "]"); try { ctx.cache().context().rollbackTxAsync(cacheTx).get(); } catch (IgniteCheckedException e) { throw new CacheException("Failed to rollback cache transaction.", e); } break; default: throw new IllegalArgumentException("Unknown transaction status: " + status); } }
tx.xid(), e);
/** * @param tx Tx proxy. */ public TransactionEventProxyImpl(GridNearTxLocal tx) { assert tx != null; this.tx = tx; this.xid = tx.xid(); }
/** {@inheritDoc} */ @Override public IgniteUuid xid() { return tx.xid(); }
/** {@inheritDoc} */ @Override public IgniteUuid timeoutId() { return xid(); }
/** * @param duration Duration. */ private Map<String, String> getNearTxs(long duration) { final Collection<GridNearTxLocal> txs = nearTxs(duration); final HashMap<String, String> res = new HashMap<>(txs.size()); for (GridNearTxLocal tx : txs) res.put(tx.xid().toString(), composeTx(tx)); return res; }
/** {@inheritDoc} */ @Override public void beforeCompletion() { if (log.isDebugEnabled()) log.debug("Synchronization.beforeCompletion() [xid=" + cacheTx.xid() + "]"); if (cacheTx.state() != ACTIVE) throw new CacheException("Cache transaction is not in active state."); try { cacheTx.prepare(true); } catch (IgniteCheckedException e) { throw new CacheException("Failed to prepare cache transaction.", e); } }
/** {@inheritDoc} */ @Override public void afterCompletion(int status) { switch (status) { case Status.STATUS_COMMITTED: if (log.isDebugEnabled()) log.debug("Synchronization.afterCompletion(STATUS_COMMITTED) [xid=" + cacheTx.xid() + "]"); try { ctx.cache().context().commitTxAsync(cacheTx).get(); } catch (IgniteCheckedException e) { throw new CacheException("Failed to commit cache transaction.", e); } break; case Status.STATUS_ROLLEDBACK: if (log.isDebugEnabled()) log.debug("Synchronization.afterCompletion(STATUS_ROLLEDBACK) [xid=" + cacheTx.xid() + "]"); try { ctx.cache().context().rollbackTxAsync(cacheTx).get(); } catch (IgniteCheckedException e) { throw new CacheException("Failed to rollback cache transaction.", e); } break; default: throw new IllegalArgumentException("Unknown transaction status: " + status); } }
tx.xid(), e);