@Override public void onConnectionClose(ClientConnection clientConnection) { Address endpoint = clientConnection.getRemoteEndpoint(); if (endpoint != null) { connections.remove(clientConnection.getRemoteEndpoint()); ownerConnectionFuture.closeIfAddressMatches(endpoint); } }
private void closeIfAddressMatches(Address address) { final ClientConnection currentOwnerConnection = ownerConnection; if (currentOwnerConnection == null || !currentOwnerConnection.live()) { return; } if (address.equals(currentOwnerConnection.getRemoteEndpoint())) { close(); } }
protected void send(ClientInvocation invocation, ClientConnection connection) throws IOException { if (isShutdown) { throw new HazelcastClientNotActiveException("Client is shut down"); } registerInvocation(invocation); ClientMessage clientMessage = invocation.getClientMessage(); if (!isAllowedToSendRequest(connection, invocation) || !writeToConnection(connection, clientMessage)) { final int callId = clientMessage.getCorrelationId(); deRegisterCallId(callId); deRegisterEventHandler(callId); throw new IOException("Packet not send to " + connection.getRemoteEndpoint()); } invocation.setSendConnection(connection); }
protected void send(ClientInvocation invocation, ClientConnection connection) throws IOException { if (isShutdown) { throw new HazelcastClientNotActiveException("Client is shut down"); } registerInvocation(invocation); ClientMessage clientMessage = invocation.getClientMessage(); if (!isAllowedToSendRequest(connection, invocation) || !writeToConnection(connection, clientMessage)) { final int callId = clientMessage.getCorrelationId(); ClientInvocation clientInvocation = deRegisterCallId(callId); deRegisterEventHandler(callId); if (clientInvocation != null) { throw new IOException("Packet not send to " + connection.getRemoteEndpoint()); } else { if (logger.isFinestEnabled()) { logger.finest("Invocation not found to deregister for call id " + callId); } } } invocation.setSendConnection(connection); }