InputStream readChannel ( int channel ) throws IOException { while ( ! isClosed ) { if ( inputReady [ channel ] ) { inputReady [ channel ] = false ; return is ; } boolean canRead = false ; synchronized ( READ_LOCK ) { if ( ! isReadLocked ) { isReadLocked = true ; canRead = true ; } else { try { READ_LOCK . wait ( 5000 ) ; } catch ( Exception e ) { } } } if ( canRead ) { try { readData ( ) ; } catch ( IOException e ) { close ( ) ; } } } return null ; }
Reads data from a channel .