Source:
<code>public void testConcurrentPutRemove() throws Exception { CountDownLatch finishLatch = new CountDownLatch(4); IgniteEx srv1 = ignitionStart(serverConfiguration(1), finishLatch); ignitionStart(serverConfiguration(2), finishLatch); ignitionStart(serverConfiguration(3), finishLatch); ignitionStart(serverConfiguration(4), finishLatch); srv1.cluster().state(ClusterState.ACTIVE); createCache(srv1); loadData(srv1, 0, LARGE_NUM_ENTRIES); final AtomicBoolean stopped = new AtomicBoolean(); IgniteInternalFuture<?> task = multithreadedAsync(() -> { while (!stopped.get()) { Ignite node = grid(ThreadLocalRandom.current().nextInt(1, 5)); ThreadLocalRandom rnd = ThreadLocalRandom.current(); int i = rnd.nextInt(0, LARGE_NUM_ENTRIES); BinaryObject val = node.binary().builder(POI_CLASS_NAME) .setField(NAME_FIELD_NAME, "POI_" + i, String.class) .setField(LATITUDE_FIELD_NAME, rnd.nextDouble(), Double.class) .setField(LONGITUDE_FIELD_NAME, rnd.nextDouble(), Double.class) .build(); IgniteCache<Object, BinaryObject> cache = node.cache(POI_CACHE_NAME).withKeepBinary(); try { if (ThreadLocalRandom.current().nextBoolean()) cache.put(i, val); else cache.remove(i); } catch (CacheException e) { <START> if (!X.hasCause(e, TransactionSerializationException.class)) <END> throw e; } } return null; }, 4); Thread.sleep(2_000L); enableIndexing(srv1).get(); stopped.set(true); task.get(); finishLatch.await(); IgniteCache<Object, Object> cache = srv1.cache(POI_CACHE_NAME).withKeepBinary(); query(srv1, SELECT_ALL_QUERY).forEach(res -> { BinaryObject val = (BinaryObject)cache.get(res.get(0)); assertNotNull(val); assertEquals(val.field(NAME_FIELD_NAME), res.get(1)); assertEquals(val.field(LATITUDE_FIELD_NAME), res.get(2)); assertEquals(val.field(LONGITUDE_FIELD_NAME), res.get(3)); }); }</code><technical_language>ignore TransactionSerializationException</technical_language>

Target:
public void testConcurrentPutRemove() throws Exception { CountDownLatch finishLatch = new CountDownLatch(4); IgniteEx srv1 = ignitionStart(serverConfiguration(1), finishLatch); ignitionStart(serverConfiguration(2), finishLatch); ignitionStart(serverConfiguration(3), finishLatch); ignitionStart(serverConfiguration(4), finishLatch); srv1.cluster().state(ClusterState.ACTIVE); createCache(srv1); loadData(srv1, 0, LARGE_NUM_ENTRIES); final AtomicBoolean stopped = new AtomicBoolean(); final CountDownLatch iterations = new CountDownLatch(1000); IgniteInternalFuture<?> task = multithreadedAsync(() -> { while (!stopped.get()) { Ignite node = grid(ThreadLocalRandom.current().nextInt(1, 5)); ThreadLocalRandom rnd = ThreadLocalRandom.current(); int i = rnd.nextInt(0, LARGE_NUM_ENTRIES); BinaryObject val = node.binary().builder(POI_CLASS_NAME) .setField(NAME_FIELD_NAME, "POI_" + i, String.class) .setField(LATITUDE_FIELD_NAME, rnd.nextDouble(), Double.class) .setField(LONGITUDE_FIELD_NAME, rnd.nextDouble(), Double.class) .build(); IgniteCache<Object, BinaryObject> cache = node.cache(POI_CACHE_NAME).withKeepBinary(); try { if (ThreadLocalRandom.current().nextBoolean()) cache.put(i, val); else cache.remove(i); } catch (CacheException e) { if (!X.hasCause(e, TransactionSerializationException.class)) throw e; } finally { iterations.countDown(); } } return null; }, 4); iterations.await(2, TimeUnit.SECONDS); enableIndexing(srv1).get(); stopped.set(true); task.get(); finishLatch.await(); IgniteCache<Object, Object> cache = srv1.cache(POI_CACHE_NAME).withKeepBinary(); query(srv1, SELECT_ALL_QUERY).forEach(res -> { BinaryObject val = (BinaryObject)cache.get(res.get(0)); assertNotNull(val); assertEquals(val.field(NAME_FIELD_NAME), res.get(1)); assertEquals(val.field(LATITUDE_FIELD_NAME), res.get(2)); assertEquals(val.field(LONGITUDE_FIELD_NAME), res.get(3)); }); }