コード例 #1
0
 @Override
 public void onConnectionClose(ClientConnection clientConnection) {
   Address endpoint = clientConnection.getRemoteEndpoint();
   if (endpoint != null) {
     connections.remove(clientConnection.getRemoteEndpoint());
     ownerConnectionFuture.closeIfAddressMatches(endpoint);
   }
 }
コード例 #2
0
 private void closeIfAddressMatches(Address address) {
   final ClientConnection currentOwnerConnection = ownerConnection;
   if (currentOwnerConnection == null || !currentOwnerConnection.live()) {
     return;
   }
   if (address.equals(currentOwnerConnection.getRemoteEndpoint())) {
     close();
   }
 }
コード例 #3
0
  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);
  }
コード例 #4
0
  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);
  }