Search in sources :

Example 1 with ClientAwareService

use of com.hazelcast.spi.ClientAwareService in project hazelcast by hazelcast.

the class ClientDisconnectionOperation method run.

@Override
public void run() throws Exception {
    ClientEngineImpl engine = getService();
    final ClientEndpointManagerImpl endpointManager = (ClientEndpointManagerImpl) engine.getEndpointManager();
    if (!engine.removeOwnershipMapping(clientUuid, memberUuid)) {
        return;
    }
    Set<ClientEndpoint> endpoints = endpointManager.getEndpoints(clientUuid);
    // This part cleans up listener and transactions
    for (ClientEndpoint endpoint : endpoints) {
        endpoint.getConnection().close("ClientDisconnectionOperation: Client disconnected from cluster", null);
    }
    // This part cleans up locks conditions semaphore etc..
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    nodeEngine.onClientDisconnected(clientUuid);
    Collection<ClientAwareService> services = nodeEngine.getServices(ClientAwareService.class);
    for (ClientAwareService service : services) {
        service.clientDisconnected(clientUuid);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ClientAwareService(com.hazelcast.spi.ClientAwareService) ClientEndpointManagerImpl(com.hazelcast.client.impl.ClientEndpointManagerImpl) ClientEngineImpl(com.hazelcast.client.impl.ClientEngineImpl) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Aggregations

ClientEndpoint (com.hazelcast.client.ClientEndpoint)1 ClientEndpointManagerImpl (com.hazelcast.client.impl.ClientEndpointManagerImpl)1 ClientEngineImpl (com.hazelcast.client.impl.ClientEngineImpl)1 ClientAwareService (com.hazelcast.spi.ClientAwareService)1 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)1