public C accept ( ) throws IOException { try { synchronized ( this ) { if ( connState != CONN_STATE_READY_FOR_ACCEPT ) { throw new IOException ( "bind needs to be called before accept (1), current state =" + connState ) ; } logger . info ( "starting accept" ) ; if ( requested . peek ( ) == null ) { wait ( ) ; } } C endpoint = requested . poll ( ) ; logger . info ( "connect request received" ) ; endpoint . accept ( ) ; return endpoint ; } catch ( Exception e ) { throw new IOException ( e ) ; } }
Extract the first connection request on the queue of pending connections .