@Override public CountDownLatch call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheCountDownLatchValue val = cacheView.get(key); if (val == null) { if (log.isDebugEnabled()) log.debug("Failed to find count down latch with given name: " + name); return new CountDownLatch(0); } tx.commit(); return new CountDownLatch(val.get()); } } });
@Override public Integer call() throws Exception { try ( GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ) ) { GridCacheSemaphoreState val = cacheView.get(key); if (val == null) throw new IgniteException("Failed to find semaphore with given name: " + name); int cnt = val.getCount(); tx.rollback(); return cnt; } } });
@Override public Void call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicReferenceValue<T> ref = cacheView.get(key); if (ref == null) throw new IgniteException("Failed to find atomic reference with given name: " + name); cacheView.put(key, new GridCacheAtomicReferenceValue<>(val)); tx.commit(); } return null; } });
@Override public Void call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicStampedValue<T, S> ref = cacheView.get(key); if (ref == null) throw new IgniteException("Failed to find atomic stamped with given name: " + name); cacheView.put(key, new GridCacheAtomicStampedValue<>(val, stamp)); tx.commit(); } return null; } });
@Override public Boolean call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheLockState val = cacheView.get(key);
@Override public Sync call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheLockState val = cacheView.get(key); if (val == null) { if (log.isDebugEnabled()) log.debug("Failed to find reentrant lock with given name: " + name); return null; } tx.rollback(); return new Sync(val); } } });
@Override public Long call() throws Exception { assert distUpdateFreeTop.isHeldByCurrentThread() || distUpdateLockedTop.isHeldByCurrentThread(); try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicSequenceValue seq = cacheView.get(key);
@Override public Boolean call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheLockState val = cacheView.get(key);
@Override public Boolean call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicReferenceValue<T> ref = cacheView.get(key); if (ref == null) throw new IgniteException("Failed to find atomic reference with given name: " + name); T curVal = ref.get(); if (!F.eq(expVal, curVal)) return false; else { cacheView.put(key, new GridCacheAtomicReferenceValue<>(newVal)); tx.commit(); return true; } } } });
@Override public T call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicReferenceValue<T> ref = cacheView.get(key); if (ref == null) throw new IgniteException("Failed to find atomic reference with given name: " + name); T curVal = ref.get(); if (!F.eq(expVal, curVal)) return curVal; else { cacheView.put(key, new GridCacheAtomicReferenceValue<>(newVal)); tx.commit(); return expVal; } } } });
/** {@inheritDoc} */ @Override public Integer call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheCountDownLatchValue latchVal = cacheView.get(key); if (latchVal == null) { if (log.isDebugEnabled()) log.debug("Failed to find count down latch with given name: " + name); return 0; } int retVal; if (val > 0) { retVal = latchVal.get() - val; if (retVal < 0) retVal = 0; } else retVal = 0; latchVal.set(retVal); cacheView.put(key, latchVal); tx.commit(); return retVal; } } }
@Override public Boolean call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicStampedValue<T, S> val = cacheView.get(key); if (val == null) throw new IgniteException("Failed to find atomic stamped with given name: " + name); if (F.eq(expVal, val.value()) && F.eq(expStamp, val.stamp())) { cacheView.put(key, new GridCacheAtomicStampedValue<>(newVal, newStamp)); tx.commit(); return true; } return false; } } });
@Override public Boolean call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)
@Override public Sync call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheSemaphoreState val = cacheView.get(key); if (val == null) { if (log.isDebugEnabled()) log.debug("Failed to find semaphore with given name: " + name); return null; } final int cnt = val.getCount(); Map<UUID, Integer> waiters = val.getWaiters(); final boolean failoverSafe = val.isFailoverSafe(); tx.commit(); Sync sync = new Sync(cnt, waiters, failoverSafe); sync.setBroken(val.isBroken()); return sync; } } });
@Override public Boolean call() throws Exception { try ( GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)
@Override public Boolean call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheLockState val = cacheView.get(key);
/** * Success if explicit tx doesn't fail. * * @param cache Cache instance. * @throws Exception If failed. */ protected void checkStartTxSuccess(final IgniteInternalCache<Object, Object> cache) throws Exception { try (final GridNearTxLocal tx = CU.txStartInternal(cache.context(), cache, PESSIMISTIC, REPEATABLE_READ)) { assert tx != null; sleepForTxFailure(); cache.put("key", "val"); tx.commit(); } assert cache.containsKey("key"); cache.clear(); }
@Override public Sync call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheLockState val = cacheView.get(key); if (val == null) { if (log.isDebugEnabled()) log.debug("Failed to find reentrant lock with given name: " + name); return null; } tx.rollback(); return new Sync(val); } } });
@Override public Void call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicReferenceValue<T> ref = cacheView.get(key); if (ref == null) throw new IgniteException("Failed to find atomic reference with given name: " + name); cacheView.put(key, new GridCacheAtomicReferenceValue<>(val)); tx.commit(); } return null; } });
@Override public Void call() throws Exception { try (GridNearTxLocal tx = CU.txStartInternal(ctx, cacheView, PESSIMISTIC, REPEATABLE_READ)) { GridCacheAtomicStampedValue<T, S> ref = cacheView.get(key); if (ref == null) throw new IgniteException("Failed to find atomic stamped with given name: " + name); cacheView.put(key, new GridCacheAtomicStampedValue<>(val, stamp)); tx.commit(); } return null; } });