use of com.hazelcast.client.map.helpers.GenericEvent in project hazelcast by hazelcast.
the class ClientMapTest method testIssue537.
@Test
@SuppressWarnings("deprecation")
public void testIssue537() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(2);
final CountDownLatch nullLatch = new CountDownLatch(2);
EntryListener<String, GenericEvent> listener = new EntryAdapter<String, GenericEvent>() {
@Override
public void entryAdded(EntryEvent<String, GenericEvent> event) {
latch.countDown();
}
@Override
public void entryEvicted(EntryEvent<String, GenericEvent> event) {
GenericEvent value = event.getValue();
GenericEvent oldValue = event.getOldValue();
if (value == null) {
nullLatch.countDown();
}
if (oldValue != null) {
nullLatch.countDown();
}
latch.countDown();
}
};
IMap<String, GenericEvent> map = createMap();
String id = map.addEntryListener(listener, true);
map.put("key1", new GenericEvent("value1"), 2, TimeUnit.SECONDS);
assertOpenEventually(latch);
assertOpenEventually(nullLatch);
map.removeEntryListener(id);
map.put("key2", new GenericEvent("value2"));
assertEquals(1, map.size());
}
Aggregations