/** * Start transaction on meta cache. * * @return Transaction. */ private GridNearTxLocal startTx() { return metaCache.txStartEx(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); }
/** {@inheritDoc} */ @Override public GridNearTxLocal txStartEx( TransactionConcurrency concurrency, TransactionIsolation isolation ) { return delegate.get().txStartEx(concurrency, isolation); }
/** {@inheritDoc} */ @Override public GridNearTxLocal txStartEx(TransactionConcurrency concurrency, TransactionIsolation isolation) { CacheOperationContext prev = gate.enter(opCtx); try { return delegate.txStartEx(concurrency, isolation); } finally { gate.leave(prev); } }
/** * @param ctx Context. * @param prj Projection. * @param concurrency Concurrency. * @param isolation Isolation. * @return New transaction. */ public static GridNearTxLocal txStartInternal(GridCacheContext ctx, IgniteInternalCache prj, TransactionConcurrency concurrency, TransactionIsolation isolation) { assert ctx != null; assert prj != null; ctx.tm().resetContext(); return prj.txStartEx(concurrency, isolation); }
/** * Execute closure inside cache transaction. * * @param cache Cache. * @param concurrency Concurrency. * @param isolation Isolation. * @param clo Closure. * @throws IgniteCheckedException If failed. */ public static <K, V> void inTx(IgniteInternalCache<K, V> cache, TransactionConcurrency concurrency, TransactionIsolation isolation, IgniteInClosureX<IgniteInternalCache<K ,V>> clo) throws IgniteCheckedException { try (GridNearTxLocal tx = cache.txStartEx(concurrency, isolation)) { clo.applyx(cache); tx.commit(); } }
nodes = null; try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { GridServiceAssignmentsKey key = new GridServiceAssignmentsKey(cfg.getName());
while(true) { try { try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { AtomicDataStructureValue val = cache.get(key);
/** * @throws Exception If failed. */ @Test public void testGridNearTxLocalDuplicateAsyncCommit() throws Exception { IgniteKernal ignite = (IgniteKernal)grid(0); IgniteInternalCache<Object, Object> utilityCache = ignite.context().cache().utilityCache(); try (GridNearTxLocal itx = MvccFeatureChecker.forcedMvcc() ? utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ) : utilityCache.txStartEx(OPTIMISTIC, SERIALIZABLE)) { utilityCache.put("1", "1"); itx.commitNearTxLocalAsync(); itx.commitNearTxLocalAsync().get(); } }
colocatedKey.evictExclude(), colocatedKey.blockId()); try (GridNearTxLocal tx = dataCachePrj.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
@Override public T applyx() throws IgniteCheckedException { cache.context().gate().enter(); try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { AtomicDataStructureValue val = cache.get(key);
try (GridNearTxLocal tx = dataCachePrj.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { Map<IgfsBlockKey, byte[]> vals = dataCachePrj.getAll(F.asList(colocatedKey, key));
/** * @throws Exception If failed. */ @Test public void testSystemTxInsideUserTx() throws Exception { Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10473", MvccFeatureChecker.forcedMvcc()); IgniteKernal ignite = (IgniteKernal)grid(0); IgniteCache<Object, Object> jcache = ignite.cache(DEFAULT_CACHE_NAME); try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { jcache.get("1"); jcache.put("1", "11"); IgniteInternalCache<Object, Object> utilityCache = ignite.context().cache().utilityCache(); utilityCache.getAndPutIfAbsent("2", "2"); try (GridNearTxLocal itx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { assertEquals(null, utilityCache.get("1")); assertEquals("2", utilityCache.get("2")); assertEquals(null, utilityCache.get("3")); utilityCache.getAndPut("3", "3"); itx.commit(); } jcache.put("2", "22"); tx.commit(); } checkTransactionsCommitted(); checkEntries(DEFAULT_CACHE_NAME, "1", "11", "2", "22", "3", null); checkEntries(CU.UTILITY_CACHE_NAME, "1", null, "2", "2", "3", "3"); }
/** * Start transaction on meta cache. * * @return Transaction. */ private GridNearTxLocal startTx() { return metaCache.txStartEx(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); }
/** {@inheritDoc} */ @Override public GridNearTxLocal txStartEx(TransactionConcurrency concurrency, TransactionIsolation isolation) { CacheOperationContext prev = gate.enter(opCtx); try { return delegate.txStartEx(concurrency, isolation); } finally { gate.leave(prev); } }
/** * @param ctx Context. * @param prj Projection. * @param concurrency Concurrency. * @param isolation Isolation. * @return New transaction. */ public static GridNearTxLocal txStartInternal(GridCacheContext ctx, IgniteInternalCache prj, TransactionConcurrency concurrency, TransactionIsolation isolation) { assert ctx != null; assert prj != null; ctx.tm().resetContext(); return prj.txStartEx(concurrency, isolation); }
/** * Execute closure inside cache transaction. * * @param cache Cache. * @param concurrency Concurrency. * @param isolation Isolation. * @param clo Closure. * @throws IgniteCheckedException If failed. */ public static <K, V> void inTx(IgniteInternalCache<K, V> cache, TransactionConcurrency concurrency, TransactionIsolation isolation, IgniteInClosureX<IgniteInternalCache<K ,V>> clo) throws IgniteCheckedException { try (GridNearTxLocal tx = cache.txStartEx(concurrency, isolation)) { clo.applyx(cache); tx.commit(); } }
while(true) { try { try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { AtomicDataStructureValue val = cache.get(key);
colocatedKey.evictExclude(), colocatedKey.blockId()); try (GridNearTxLocal tx = dataCachePrj.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
@Override public T applyx() throws IgniteCheckedException { cache.context().gate().enter(); try (GridNearTxLocal tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { AtomicDataStructureValue val = cache.get(key);
try (GridNearTxLocal tx = dataCachePrj.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { Map<IgfsBlockKey, byte[]> vals = dataCachePrj.getAll(F.asList(colocatedKey, key));