private void doClose() {
    open = false;
    connections.remove(this);

    for (Map.Entry<Long, ContextualFuture> entry : futures.entrySet()) {
      ContextualFuture future = entry.getValue();
      try {
        future.context.executor().execute(() -> future.completeExceptionally(new ConnectException("connection closed")));
      } catch (RejectedExecutionException e) {
      }
    }
    futures.clear();

    for (Consumer<Connection> closeListener : closeListeners) {
      try {
        context.executor().execute(() -> closeListener.accept(this));
      } catch (RejectedExecutionException e) {
      }
    }
  }
private void doClose ( ) { open = false ; connections . remove ( this ) ; for ( Map . Entry < Long , ContextualFuture > entry : futures . entrySet ( ) ) { ContextualFuture future = entry . getValue ( ) ; try { future . context . executor ( ) . execute ( ( ) -> future . completeExceptionally ( new ConnectException ( "connection closed" ) ) ) ; } catch ( RejectedExecutionException e ) { } } futures . clear ( ) ; for ( Consumer < Connection > closeListener : closeListeners ) { try { context . executor ( ) . execute ( ( ) -> closeListener . accept ( this ) ) ; } catch ( RejectedExecutionException e ) { } } }
Closes the connection.