use of org.apache.ignite.internal.processors.datastructures.GridCacheInternalKey in project ignite by apache.
the class GridCachePartitionedNodeRestartTxSelfTest method checkCustom.
/**
* Test {@link GridCacheInternalKey}/{@link GridCacheAtomicLongValue}.
* @param name Name.
* @throws Exception If failed.
*/
private void checkCustom(String name) throws Exception {
for (int i = INIT_GRID_NUM; i < 20; i++) {
startGrid(i);
assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
try (Transaction tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
GridCacheInternalKey key = new GridCacheInternalKeyImpl(name);
GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).cache(DEFAULT_CACHE_NAME).get(key));
assertNotNull(atomicVal);
assertEquals("Custom check failed for node: " + i, (long) i, atomicVal.get());
atomicVal.set(i + 1);
grid(i).cache(DEFAULT_CACHE_NAME).put(key, atomicVal);
tx.commit();
}
stopGrid(i);
}
}
Aggregations