use of com.hazelcast.instance.impl.Node in project hazelcast by hazelcast.
the class ListenerLeakTest method testDistributedObjectListeners.
@Test
public void testDistributedObjectListeners() {
Collection<Node> nodes = createNodes();
HazelcastInstance client = newHazelcastClient();
UUID id = client.addDistributedObjectListener(mock(DistributedObjectListener.class));
Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
assertTrue(client.removeDistributedObjectListener(id));
assertNoLeftOver(nodes, client, id, registrations);
}
use of com.hazelcast.instance.impl.Node in project hazelcast by hazelcast.
the class ListenerLeakTest method testTopicMessageListener.
@Test
public void testTopicMessageListener() {
Collection<Node> nodes = createNodes();
HazelcastInstance client = newHazelcastClient();
ITopic<Object> topic = client.getTopic(randomString());
UUID id = topic.addMessageListener(mock(MessageListener.class));
Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
assertTrue(topic.removeMessageListener(id));
assertNoLeftOver(nodes, client, id, registrations);
}
use of com.hazelcast.instance.impl.Node in project hazelcast by hazelcast.
the class ListenerLeakTest method testMapPartitionLostListeners.
@Test
public void testMapPartitionLostListeners() {
Collection<Node> nodes = createNodes();
HazelcastInstance client = newHazelcastClient();
IMap map = client.getMap(randomString());
UUID id = map.addPartitionLostListener(mock(MapPartitionLostListener.class));
Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
assertTrue(map.removePartitionLostListener(id));
assertNoLeftOver(nodes, client, id, registrations);
}
use of com.hazelcast.instance.impl.Node in project hazelcast by hazelcast.
the class ListenerLeakTest method testListListeners.
@Test
public void testListListeners() {
Collection<Node> nodes = createNodes();
HazelcastInstance client = newHazelcastClient();
IList<Object> list = client.getList(randomString());
UUID id = list.addItemListener(mock(ItemListener.class), false);
Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
assertTrue(list.removeItemListener(id));
assertNoLeftOver(nodes, client, id, registrations);
}
use of com.hazelcast.instance.impl.Node in project hazelcast by hazelcast.
the class NodeQueryCacheContext method flushPublishersOnNodeShutdown.
/**
* This is a best effort approach; there is no guarantee that events in publishers internal buffers will be fired,
* {@link EventService} can drop them.
*/
private void flushPublishersOnNodeShutdown() {
Node node = ((NodeEngineImpl) this.nodeEngine).getNode();
LifecycleServiceImpl lifecycleService = node.hazelcastInstance.getLifecycleService();
lifecycleService.addLifecycleListener(event -> {
if (SHUTTING_DOWN == event.getState()) {
publisherContext.flush();
}
});
}
Aggregations