@Override public T2<GridCacheAtomicLongEx, AtomicDataStructureValue> get(GridCacheInternalKey key, AtomicDataStructureValue val, IgniteInternalCache cache) throws IgniteCheckedException { // Check that atomic long hasn't been created in other thread yet. GridCacheAtomicLongEx a = cast(dsMap.get(key), GridCacheAtomicLongEx.class); if (a != null) { assert val != null; return new T2<>(a, null); } if (val == null && !create) return null; GridCacheAtomicLongValue retVal = (val == null ? new GridCacheAtomicLongValue(initVal) : null); a = new GridCacheAtomicLongImpl(name, key, cache); return new T2<GridCacheAtomicLongEx, AtomicDataStructureValue>(a, retVal); } }, cfg, name, ATOMIC_LONG, create, GridCacheAtomicLongEx.class);
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); e.setValue(new GridCacheAtomicLongValue(curVal + delta)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); e.setValue(new GridCacheAtomicLongValue(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() + delta; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() + 1; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() - 1; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); if (curVal == expVal) e.setValue(new GridCacheAtomicLongValue(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long ret = val.get(); e.setValue(new GridCacheAtomicLongValue(ret + 1)); return ret; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long ret = val.get(); e.setValue(new GridCacheAtomicLongValue(ret - 1)); return ret; }
((IgniteKernal)grid(0)).getCache(cacheName).getAndPut(new GridCacheInternalKeyImpl("LONG", ""), new GridCacheAtomicLongValue(0));
/** * Prepare test environment. * @param key Key. * @throws Exception If failed. */ private void prepareCustom(String key) throws Exception { // Start nodes. for (int i = 0; i < INIT_GRID_NUM; i++) assert startGrid(i) != null; for (int i = 0; i < INIT_GRID_NUM; i++) assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode(); // Init cache data. try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { // Put custom data grid(0).cache(DEFAULT_CACHE_NAME).put(new GridCacheInternalKeyImpl(key, "testGroup"), new GridCacheAtomicLongValue(INIT_GRID_NUM)); tx.commit(); } stopGrid(0); }
@Override public T2<GridCacheAtomicLongEx, AtomicDataStructureValue> get(GridCacheInternalKey key, AtomicDataStructureValue val, IgniteInternalCache cache) throws IgniteCheckedException { // Check that atomic long hasn't been created in other thread yet. GridCacheAtomicLongEx a = cast(dsMap.get(key), GridCacheAtomicLongEx.class); if (a != null) { assert val != null; return new T2<>(a, null); } if (val == null && !create) return null; GridCacheAtomicLongValue retVal = (val == null ? new GridCacheAtomicLongValue(initVal) : null); a = new GridCacheAtomicLongImpl(name, key, cache); return new T2<GridCacheAtomicLongEx, AtomicDataStructureValue>(a, retVal); } }, cfg, name, ATOMIC_LONG, create, GridCacheAtomicLongEx.class);
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() + delta; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long ret = val.get(); e.setValue(new GridCacheAtomicLongValue(ret + 1)); return ret; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() - 1; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); e.setValue(new GridCacheAtomicLongValue(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long newVal = val.get() + 1; e.setValue(new GridCacheAtomicLongValue(newVal)); return newVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); e.setValue(new GridCacheAtomicLongValue(curVal + delta)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long curVal = val.get(); if (curVal == expVal) e.setValue(new GridCacheAtomicLongValue(newVal)); return curVal; }
/** {@inheritDoc} */ @Override public Long process(MutableEntry<GridCacheInternalKey, GridCacheAtomicLongValue> e, Object... args) { GridCacheAtomicLongValue val = e.getValue(); if (val == null) throw new EntryProcessorException("Failed to find atomic long: " + e.getKey().name()); long ret = val.get(); e.setValue(new GridCacheAtomicLongValue(ret - 1)); return ret; }