/** {@inheritDoc} */ @Override public int prepare(Xid xid) throws XAException { assert this.xid.equals(xid); if (log.isDebugEnabled()) log.debug("XA resource prepare(...) [xid=" + xid + "]"); if (cacheTx.state() != ACTIVE) throw new XAException("Cache transaction is not in active state."); try { cacheTx.prepare(true); } catch (IgniteCheckedException e) { throwException("Failed to prepare cache transaction.", e); } return XA_OK; }
/** {@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); } }
@Override public void run() { IgniteCache<Object, Object> c = jcache(0); try { Transaction tx = grid(0).transactions().txStart(mode, REPEATABLE_READ); for (Integer key : keys) c.put(key, "val" + key); if (prepare) ((TransactionProxyImpl)tx).tx().prepare(true); } catch (IgniteCheckedException e) { info("Failed to put keys to cache: " + e.getMessage()); } } }, 1);
/** {@inheritDoc} */ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_PREPARE: ((TransactionProxyImpl)tx(val)).tx().prepare(true); return TRUE; case OP_COMMIT: tx(val).commit(); return txClose(val); case OP_ROLLBACK: tx(val).rollback(); return txClose(val); case OP_CLOSE: return txClose(val); case OP_SET_ROLLBACK_ONLY: return tx(val).setRollbackOnly() ? TRUE : FALSE; case OP_STATE: return tx(val).state().ordinal(); case OP_RESET_METRICS: txs.resetMetrics(); return TRUE; } return super.processInLongOutLong(type, val); }
txEx.prepare(true);
/** {@inheritDoc} */ @Override public int prepare(Xid xid) throws XAException { assert this.xid.equals(xid); if (log.isDebugEnabled()) log.debug("XA resource prepare(...) [xid=" + xid + "]"); if (cacheTx.state() != ACTIVE) throw new XAException("Cache transaction is not in active state."); try { cacheTx.prepare(true); } catch (IgniteCheckedException e) { throwException("Failed to prepare cache transaction.", e); } return XA_OK; }
/** {@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 long processInLongOutLong(int type, long val) throws IgniteCheckedException { switch (type) { case OP_PREPARE: ((TransactionProxyImpl)tx(val)).tx().prepare(true); return TRUE; case OP_COMMIT: tx(val).commit(); return txClose(val); case OP_ROLLBACK: tx(val).rollback(); return txClose(val); case OP_CLOSE: return txClose(val); case OP_SET_ROLLBACK_ONLY: return tx(val).setRollbackOnly() ? TRUE : FALSE; case OP_STATE: return tx(val).state().ordinal(); case OP_RESET_METRICS: txs.resetMetrics(); return TRUE; } return super.processInLongOutLong(type, val); }