@Override public void run() { cleanupEndpointsWithDeadConnections(); for (ClientEndpoint clientEndpoint : clientEndpointManager.getEndpoints()) { monitor(clientEndpoint); } }
@Override public void run() { cleanupEndpointsWithDeadConnections(); for (ClientEndpoint clientEndpoint : clientEndpointManager.getEndpoints()) { monitor(clientEndpoint); } }
private void cleanupEndpointsWithDeadConnections() { for (ClientEndpoint endpoint : clientEndpointManager.getEndpoints()) { if (!endpoint.getConnection().isAlive()) { //if connection is not alive, it means we come across an edge case. //normally connection close should remove endpoint from client endpoint manager //this means that connection.close happened before, authentication complete(endpoint registered to manager) //therefore connection.close could not remove the endpoint. //we will remove the endpoint here when detected. if (logger.isFineEnabled()) { logger.fine("Cleaning up endpoints with dead connection " + endpoint); } clientEndpointManager.removeEndpoint(endpoint); } } }
private void cleanupEndpointsWithDeadConnections() { for (ClientEndpoint endpoint : clientEndpointManager.getEndpoints()) { if (!endpoint.getConnection().isAlive()) { //if connection is not alive, it means we come across an edge case. //normally connection close should remove endpoint from client endpoint manager //this means that connection.close happened before, authentication complete(endpoint registered to manager) //therefore connection.close could not remove the endpoint. //we will remove the endpoint here when detected. if (logger.isFineEnabled()) { logger.fine("Cleaning up endpoints with dead connection " + endpoint); } clientEndpointManager.removeEndpoint(endpoint); } } }
private boolean doRun() throws Exception { ILogger logger = getLogger(); ClientEngineImpl engine = getService(); String memberUuid = getCallerUuid(); if (!engine.trySetLastAuthenticationCorrelationId(clientUuid, authCorrelationId)) { String message = "Server already processed a newer authentication from client with UUID " + clientUuid + ". Not applying requested ownership change to " + memberUuid; logger.info(message); throw new StubAuthenticationException(message); } Set<ClientEndpoint> endpoints = engine.getEndpointManager().getEndpoints(clientUuid); for (ClientEndpoint endpoint : endpoints) { ClientPrincipal principal = new ClientPrincipal(clientUuid, memberUuid); endpoint.authenticated(principal); } String previousMemberUuid = engine.addOwnershipMapping(clientUuid, memberUuid); if (logger.isFineEnabled()) { logger.fine("Client authenticated " + clientUuid + ", owner " + memberUuid); } return previousMemberUuid == null; }
private boolean doRun() throws Exception { ILogger logger = getLogger(); ClientEngineImpl engine = getService(); String memberUuid = getCallerUuid(); if (!engine.trySetLastAuthenticationCorrelationId(clientUuid, authCorrelationId)) { String message = "Server already processed a newer authentication from client with UUID " + clientUuid + ". Not applying requested ownership change to " + memberUuid; logger.info(message); throw new StubAuthenticationException(message); } Set<ClientEndpoint> endpoints = engine.getEndpointManager().getEndpoints(clientUuid); for (ClientEndpoint endpoint : endpoints) { ClientPrincipal principal = new ClientPrincipal(clientUuid, memberUuid); endpoint.authenticated(principal); } String previousMemberUuid = engine.addOwnershipMapping(clientUuid, memberUuid); if (logger.isFineEnabled()) { logger.fine("Client authenticated " + clientUuid + ", owner " + memberUuid); } return previousMemberUuid == null; }