protected int poll ( final long timeout , final boolean dispatchEvents ) { // get all the raw items final Set < PollItem > pollItems = new HashSet <> ( ) ; for ( CompositePollItem it : all ) { pollItems . add ( it . item ( ) ) ; } // polling time final int rc = poll ( selector , timeout , pollItems ) ; if ( ! dispatchEvents ) { // raw result return rc ; } if ( dispatch ( all , pollItems . size ( ) ) ) { // returns event counts after dispatch if everything went fine return rc ; } // error in dispatching return - 1 ; }
Issue a poll call using the specified timeout value .