public synchronized boolean hasNext ( ) { while ( nexting ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "[" + this + "] Waiting for another thread to pull item..." ) ; } try { wait ( 150L ) ; } catch ( InterruptedException e ) { /* ignore */ } } if ( loadException != null ) { throw new JiteratorLoadException ( loadException ) ; } nexting = true ; try { if ( waiting == null ) { return false ; } if ( ! waiting . isEmpty ( ) ) { return true ; } waitForPush ( ) ; if ( loadException != null ) { throw new JiteratorLoadException ( loadException ) ; } return ( waiting != null && ! waiting . isEmpty ( ) ) ; } finally { nexting = false ; notifyAll ( ) ; } }
Checks to see if there are more elements to be processed in the jiterator . If this method is called prior to the jiterator being loaded with an item it will hang until either an item is added into the jiterator or the jiterator is marked as complete .