use of org.infinispan.query.Indexer in project infinispan by infinispan.
the class MassIndexingTest method testOverlappingMassIndexers.
@Test
public void testOverlappingMassIndexers() {
Cache<Integer, Car> cache = cache(0);
IntStream.range(0, 10).forEach(i -> cache.put(i, new Car("whatever", "whatever", 0)));
Indexer massIndexer = Search.getIndexer(cache);
CountDownLatch latch = new CountDownLatch(1);
instrumentIndexer(massIndexer, latch);
CompletionStage<Void> first = massIndexer.run();
CompletionStage<Void> second = massIndexer.run();
latch.countDown();
assertTrue(isSuccess(second) && isError(first) || isSuccess(first) && isError(second));
assertFalse(massIndexer.isRunning());
CompletionStage<Void> third = massIndexer.run();
assertTrue(isSuccess(third));
}
Aggregations