/** {@inheritDoc} */ @Override protected void operation(int key) throws Exception { cache.get(key); } }
@Override public Boolean call() throws Exception { return cache.get(key) != null; } });
/** * Get info. * * @param id ID. * @return Info. * @throws IgniteCheckedException If failed. */ @Nullable private IgfsEntryInfo getInfo(IgniteUuid id) throws IgniteCheckedException { return id2InfoPrj.get(id); }
/** {@inheritDoc} */ @Nullable @Override public Object get(Object key) throws IgniteCheckedException { return delegate.get().get(keyTransformer.transform(key)); }
/** {@inheritDoc} */ @Nullable @Override public V get(K key) throws IgniteCheckedException { CacheOperationContext prev = gate.enter(opCtx); try { return delegate.get(key); } finally { gate.leave(prev); } }
/** {@inheritDoc} */ @Override public int count() { try { GridCacheCountDownLatchValue latchVal = cacheView.get(key); return latchVal == null ? 0 : latchVal.get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** * @param cache Utility cache. * @param svcName Service name. * @return Service topology. * @throws IgniteCheckedException In case of error. */ private static Map<UUID, Integer> serviceTopology(IgniteInternalCache<Object, Object> cache, String svcName) throws IgniteCheckedException { GridServiceAssignments val = (GridServiceAssignments)cache.get(new GridServiceAssignmentsKey(svcName)); return val != null ? val.assigns() : null; }
final boolean isLocked() throws IgniteCheckedException { return getState() != 0 || cacheView.get(key).get() != 0; }
@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()); } } });
/** * @return {@code True} if set header found in cache. * @throws IgniteCheckedException If failed. */ @SuppressWarnings("unchecked") boolean checkHeader() throws IgniteCheckedException { IgniteInternalCache<GridCacheSetHeaderKey, GridCacheSetHeader> cache0 = ctx.cache(); GridCacheSetHeader hdr = cache0.get(new GridCacheSetHeaderKey(name)); return hdr != null && hdr.id().equals(id); }
/** {@inheritDoc} */ @Override public S stamp() { checkRemoved(); try { GridCacheAtomicStampedValue<T, S> stmp = cacheView.get(key); if (stmp == null) throw new IgniteCheckedException("Failed to find atomic stamped with given name: " + name); return stmp.stamp(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public T value() { checkRemoved(); try { GridCacheAtomicStampedValue<T, S> stmp = cacheView.get(key); if (stmp == null) throw new IgniteCheckedException("Failed to find atomic stamped with given name: " + name); return stmp.value(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public T get() { checkRemoved(); try { GridCacheAtomicReferenceValue<T> ref = cacheView.get(key); if (ref == null) throw new IgniteCheckedException("Failed to find atomic reference with given name: " + name); return ref.get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long get() { checkRemoved(); try { GridCacheAtomicLongValue val = cacheView.get(key); if (val == null) throw new IgniteException("Failed to find atomic long: " + name); return val.get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public IgniteBiTuple<T, S> get() { checkRemoved(); try { GridCacheAtomicStampedValue<T, S> stmp = cacheView.get(key); if (stmp == null) throw new IgniteCheckedException("Failed to find atomic stamped with given name: " + name); return stmp.get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
@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 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 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; } } });