use of com.hazelcast.ringbuffer.ReadResultSet in project hazelcast by hazelcast.
the class AbstractEventJournalBasicTest method unparkReadOperation.
/**
* Tests that event journal read operations parked on different partitions
* can be woken up independently.
*/
@Test
public void unparkReadOperation() {
final EventJournalTestContext<String, Integer, EJ_TYPE> context = createContext();
assertEventJournalSize(context.dataAdapter, 0);
final String key = randomPartitionKey();
final Integer value = RANDOM.nextInt();
final CountDownLatch latch = new CountDownLatch(1);
final BiConsumer<ReadResultSet<EJ_TYPE>, Throwable> ec = addEventExecutionCallback(context, key, value, latch);
readFromEventJournal(context.dataAdapter, 0, 100, partitionId, TRUE_PREDICATE, IDENTITY_FUNCTION).whenCompleteAsync(ec);
readFromEventJournal(context.dataAdapter, 0, 100, partitionId + 1, TRUE_PREDICATE, IDENTITY_FUNCTION).whenCompleteAsync(ec);
readFromEventJournal(context.dataAdapter, 0, 100, partitionId + 2, TRUE_PREDICATE, IDENTITY_FUNCTION).whenCompleteAsync(ec);
readFromEventJournal(context.dataAdapter, 0, 100, partitionId + 3, TRUE_PREDICATE, IDENTITY_FUNCTION).whenCompleteAsync(ec);
readFromEventJournal(context.dataAdapter, 0, 100, partitionId + 4, TRUE_PREDICATE, IDENTITY_FUNCTION).whenCompleteAsync(ec);
context.dataAdapter.put(key, value);
assertOpenEventually(latch, 30);
assertEventJournalSize(context.dataAdapter, 1);
}
Aggregations