public Boolean close ( ) { _isClosing = true ; boolean closeResult = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Initial read outstanding : " + _isInitialRead ) ; } if ( _isInitialRead ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Cancelling any outstanding read" ) ; } _tcpContext . getReadInterface ( ) . read ( 1 , _tcpChannelCallback , false , TCPReadRequestContext . IMMED_TIMEOUT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Call to cancel complete" ) ; } //This seems strange, but what happens during the timeout it will be set to false. //If it's false we don't want to do the wait since it's been called in line. //If it's true we will want to wait until the timeout has been processed if ( _isInitialRead ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Timeout has been called, waiting for it to complete" ) ; } closeResult = true ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, No read outstanding, no reason to call cancel" ) ; } closeResult = false ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, No read outstanding, no reason to call cancel" ) ; } closeResult = false ; } if ( _rl != null ) { if ( ! this . isAlldataReadCalled ( ) ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, We are now closed, calling the ReadListener onAllDataRead" ) ; } this . setAlldataReadCalled ( true ) ; _rl . onAllDataRead ( ) ; } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "close, Encountered an exception while calling onAllDAtaRead : " + ioe ) ; } } } } return closeResult ; }
Close the connection down by immediately timing out any existing read