private ClientEndpoint initEndpoint() { ClientEndpoint endpoint = endpointManager.getEndpoint(connection); if (endpoint != null) { return endpoint; } return new ClientEndpointImpl(clientEngine, nodeEngine, connection); }
@Override public void addListenerDestroyAction(final String service, final String topic, final String id) { final EventService eventService = clientEngine.getEventService(); addDestroyAction(id, new Callable<Boolean>() { @Override public Boolean call() { return eventService.deregisterListener(service, topic, id); } }); }
public void destroy() throws LoginException { clearAllListeners(); nodeEngine.onClientDisconnected(getUuid()); LoginContext lc = loginContext; if (lc != null) { lc.logout(); } for (TransactionContext context : transactionContextMap.values()) { if (context instanceof XATransactionContextImpl) { continue; } try { context.rollbackTransaction(); } catch (HazelcastInstanceNotActiveException e) { getLogger().finest(e); } catch (Exception e) { getLogger().warning(e); } } authenticated = false; }
@Override public void removeEndpoint(ClientEndpoint clientEndpoint) { checkNotNull(clientEndpoint, "endpoint can't be null"); ClientEndpointImpl endpoint = (ClientEndpointImpl) clientEndpoint; if (endpoints.remove(endpoint.getConnection()) == null) { //endpoint is already removed return; } logger.info("Destroying " + endpoint); try { endpoint.destroy(); } catch (LoginException e) { logger.warning(e); } ClientEvent event = new ClientEvent(endpoint.getUuid(), ClientEventType.DISCONNECTED, endpoint.getSocketAddress(), endpoint.getClientType(), endpoint.getName(), endpoint.getAttributes()); sendClientEvent(event); }
@Override public void run() throws Exception { ClientEngineImpl service = getService(); final Collection<Client> serviceClients = service.getClients(); this.clients = createHashMap(serviceClients.size()); for (Client clientEndpoint : serviceClients) { ClientEndpointImpl clientEndpointImpl = (ClientEndpointImpl) clientEndpoint; this.clients.put(clientEndpointImpl.getUuid(), clientEndpointImpl.getClientType()); } }
@Override public void removeEndpoint(ClientEndpoint clientEndpoint) { checkNotNull(clientEndpoint, "endpoint can't be null"); ClientEndpointImpl endpoint = (ClientEndpointImpl) clientEndpoint; if (endpoints.remove(endpoint.getConnection()) == null) { //endpoint is already removed return; } logger.info("Destroying " + endpoint); try { endpoint.destroy(); } catch (LoginException e) { logger.warning(e); } ClientEvent event = new ClientEvent(endpoint.getUuid(), ClientEventType.DISCONNECTED, endpoint.getSocketAddress(), endpoint.getClientType()); sendClientEvent(event); }
if (!endpoint.isOwnerConnection()) { logger.finest("connectionRemoved: Not the owner conn:" + connection + " for endpoint " + endpoint); return; final String clientUuid = endpoint.getUuid(); String ownerUuid = ownershipMappings.get(clientUuid); if (localMemberUuid.equals(ownerUuid)) { final long authenticationCorrelationId = endpoint.getAuthenticationCorrelationId(); try { nodeEngine.getExecutionService().schedule(new Runnable() {
private void clear(String reason) { for (ClientEndpoint ce : endpointManager.getEndpoints()) { ClientEndpointImpl endpoint = (ClientEndpointImpl) ce; try { endpoint.destroy(); } catch (LoginException e) { logger.finest(e.getMessage()); } try { final Connection conn = endpoint.getConnection(); if (conn.isAlive()) { conn.close(reason, null); } } catch (Exception e) { logger.finest(e); } } endpointManager.clear(); ownershipMappings.clear(); }
public void destroy() throws LoginException { clearAllListeners(); nodeEngine.onClientDisconnected(getUuid()); LoginContext lc = loginContext; if (lc != null) { lc.logout(); } for (TransactionContext context : transactionContextMap.values()) { if (context instanceof XATransactionContextImpl) { continue; } try { context.rollbackTransaction(); } catch (HazelcastInstanceNotActiveException e) { logger.finest(e); } catch (Exception e) { logger.warning(e); } } authenticated = false; }
if (!endpoint.isOwnerConnection()) { logger.finest("connectionRemoved: Not the owner conn:" + connection + " for endpoint " + endpoint); return; final String clientUuid = endpoint.getUuid(); String ownerUuid = ownershipMappings.get(clientUuid); if (localMemberUuid.equals(ownerUuid)) { final long authenticationCorrelationId = endpoint.getAuthenticationCorrelationId(); try { nodeEngine.getExecutionService().schedule(new Runnable() {
@Override public void run() throws Exception { ClientEngineImpl service = getService(); final Collection<Client> serviceClients = service.getClients(); this.clients = createHashMap(serviceClients.size()); for (Client clientEndpoint : serviceClients) { ClientEndpointImpl clientEndpointImpl = (ClientEndpointImpl) clientEndpoint; this.clients.put(clientEndpointImpl.getUuid(), clientEndpointImpl.getClientType()); } }
private void clear(String reason) { for (ClientEndpoint ce : endpointManager.getEndpoints()) { ClientEndpointImpl endpoint = (ClientEndpointImpl) ce; try { endpoint.destroy(); } catch (LoginException e) { logger.finest(e.getMessage()); } try { final Connection conn = endpoint.getConnection(); if (conn.isAlive()) { conn.close(reason, null); } } catch (Exception e) { logger.finest(e); } } endpointManager.clear(); ownershipMappings.clear(); }
@Override public void addListenerDestroyAction(final String service, final String topic, final String id) { final EventService eventService = clientEngine.getEventService(); addDestroyAction(id, new Callable<Boolean>() { @Override public Boolean call() { return eventService.deregisterListener(service, topic, id); } }); }
private ClientEndpoint initEndpoint() { ClientEndpoint endpoint = endpointManager.getEndpoint(connection); if (endpoint != null) { return endpoint; } return new ClientEndpointImpl(clientEngine, nodeEngine, connection); }