/** {@inheritDoc} */ @Override public long getAndIncrement() { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, GetAndIncrementProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long getAndDecrement() { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, GetAndDecrementProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long incrementAndGet() { checkRemoved(); try{ EntryProcessorResult<Long> res = cacheView.invoke(key, IncrementAndGetProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long decrementAndGet() { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, DecrementAndGetProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long getAndAdd(long l) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new GetAndAddProcessor(l)); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long getAndSet(long l) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new GetAndSetProcessor(l)); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long addAndGet(long l) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new AddAndGetProcessor(l)); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean compareAndSet(long expVal, long newVal) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new CompareAndSetProcessor(expVal, newVal)); assert res != null && res.get() != null : res; return res.get() == expVal; } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** * @param expVal Expected value. * @param newVal New value. * @return Old value. */ public long compareAndSetAndGet(long expVal, long newVal) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new CompareAndSetProcessor(expVal, newVal)); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public void set(final T val) { checkRemoved(); try { if (ctx.dataStructures().knownType(val)) cacheView.invoke(key, new ReferenceSetEntryProcessor<>(val)); else { CU.retryTopologySafe(new Callable<Void>() { @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; } }); } } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public void set(final T val, final S stamp) { checkRemoved(); try { if (ctx.dataStructures().knownType(val) && ctx.dataStructures().knownType(stamp)) cacheView.invoke(key, new StampedSetEntryProcessor<>(val, stamp)); else { CU.retryTopologySafe(new Callable<Void>() { @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; } }); } } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
throw new IgniteException(e.getMessage(), e);
throw new IgniteException(e.getMessage(), e);
throw new IgniteException(e.getMessage(), e);
/** {@inheritDoc} */ @Override public long getAndIncrement() { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, GetAndIncrementProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long getAndDecrement() { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, GetAndDecrementProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long incrementAndGet() { checkRemoved(); try{ EntryProcessorResult<Long> res = cacheView.invoke(key, IncrementAndGetProcessor.INSTANCE); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long addAndGet(long l) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new AddAndGetProcessor(l)); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public long getAndAdd(long l) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new GetAndAddProcessor(l)); assert res != null && res.get() != null : res; return res.get(); } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean compareAndSet(long expVal, long newVal) { checkRemoved(); try { EntryProcessorResult<Long> res = cacheView.invoke(key, new CompareAndSetProcessor(expVal, newVal)); assert res != null && res.get() != null : res; return res.get() == expVal; } catch (EntryProcessorException e) { throw new IgniteException(e.getMessage(), e); } catch (IgniteCheckedException e) { throw U.convertException(e); } }