Search in sources :

Example 1 with ClientListenerServiceImpl

use of com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl in project hazelcast by hazelcast.

the class ClientResponseHandlerSupplier method handleResponse.

private void handleResponse(ClientMessage message) {
    if (ClientMessage.isFlagSet(message.getHeaderFlags(), ClientMessage.BACKUP_EVENT_FLAG)) {
        ClientListenerServiceImpl listenerService = (ClientListenerServiceImpl) client.getListenerService();
        listenerService.handleEventMessageOnCallingThread(message);
        return;
    }
    long correlationId = message.getCorrelationId();
    ClientInvocation invocation = invocationService.getInvocation(correlationId);
    if (invocation == null) {
        logger.warning("No call for callId: " + correlationId + ", response: " + message);
        return;
    }
    if (EXCEPTION_MESSAGE_TYPE == message.getMessageType()) {
        invocation.notifyException(correlationId, client.getClientExceptionFactory().createException(message));
    } else {
        invocation.notify(message);
    }
}
Also used : ClientListenerServiceImpl(com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl)

Example 2 with ClientListenerServiceImpl

use of com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl in project hazelcast by hazelcast.

the class ListenerLeakTest method getClientEventRegistrations.

private Collection<ClientConnectionRegistration> getClientEventRegistrations(HazelcastInstance client, UUID id) {
    HazelcastClientInstanceImpl clientImpl = ClientTestUtil.getHazelcastClientInstanceImpl(client);
    ClientListenerServiceImpl listenerService = (ClientListenerServiceImpl) clientImpl.getListenerService();
    return listenerService.getActiveRegistrations(id).values();
}
Also used : ClientListenerServiceImpl(com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl) HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)

Example 3 with ClientListenerServiceImpl

use of com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl in project hazelcast by hazelcast.

the class AbstractListenersOnReconnectTest method getClientEventRegistrations.

private Map<Connection, ClientConnectionRegistration> getClientEventRegistrations(HazelcastInstance client, UUID id) {
    HazelcastClientInstanceImpl clientImpl = ClientTestUtil.getHazelcastClientInstanceImpl(client);
    ClientListenerServiceImpl listenerService = (ClientListenerServiceImpl) clientImpl.getListenerService();
    return listenerService.getActiveRegistrations(id);
}
Also used : ClientListenerServiceImpl(com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl) HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)

Example 4 with ClientListenerServiceImpl

use of com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl in project hazelcast by hazelcast.

the class ClientQueryCacheDestroyResourcesTest method destroy_deregisters_listeners.

@Test
public void destroy_deregisters_listeners() {
    QueryCache<String, String> queryCache1 = map1.getQueryCache(QUERY_CACHE_NAME_1);
    QueryCache<String, String> queryCache2 = map2.getQueryCache(QUERY_CACHE_NAME_2);
    QueryCache<String, String> queryCache3 = map3.getQueryCache(QUERY_CACHE_NAME_3);
    HazelcastClientInstanceImpl client = getHazelcastClientInstanceImpl(clientInstance);
    ClientListenerServiceImpl listenerService = (ClientListenerServiceImpl) client.getListenerService();
    int numberOfListenersBeforeDestroy = listenerService.getRegistrations().size();
    queryCache1.destroy();
    queryCache2.destroy();
    queryCache3.destroy();
    final Map<UUID, ClientListenerRegistration> registrations = listenerService.getRegistrations();
    // we expect at least 1 for backup listener and 1 listener for ProxyManager and
    // we expect 3 listeners to be deleted one for each queryCache.
    assertEquals(registrations.toString(), 3, numberOfListenersBeforeDestroy - registrations.size());
}
Also used : ClientListenerServiceImpl(com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl) HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) UUID(java.util.UUID) ClientListenerRegistration(com.hazelcast.client.impl.spi.impl.listener.ClientListenerRegistration) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

ClientListenerServiceImpl (com.hazelcast.client.impl.spi.impl.listener.ClientListenerServiceImpl)4 HazelcastClientInstanceImpl (com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)3 ClientListenerRegistration (com.hazelcast.client.impl.spi.impl.listener.ClientListenerRegistration)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 UUID (java.util.UUID)1 Test (org.junit.Test)1