@ Override public void close ( ) { if ( closed ) return ; closed = true ; tcpSocketConsumer . prepareToShutdown ( ) ; if ( shouldSendCloseMessage ) eventLoop . addHandler ( new EventHandler ( ) { @ Override public boolean action ( ) throws InvalidEventHandlerException { try { TcpChannelHub . this . sendCloseMessage ( ) ; tcpSocketConsumer . stop ( ) ; closed = true ; if ( LOG . isDebugEnabled ( ) ) Jvm . debug ( ) . on ( getClass ( ) , "closing connection to " + socketAddressSupplier ) ; while ( clientChannel != null ) { if ( LOG . isDebugEnabled ( ) ) Jvm . debug ( ) . on ( getClass ( ) , "waiting for disconnect to " + socketAddressSupplier ) ; } } catch ( ConnectionDroppedException e ) { throw new InvalidEventHandlerException ( e ) ; } // we just want this to run once throw new InvalidEventHandlerException ( ) ; } @ NotNull @ Override public String toString ( ) { return TcpChannelHub . class . getSimpleName ( ) + "..close()" ; } } ) ; }
called when we are completed finished with using the TcpChannelHub