@ Nonnull public ConsumerRecords < byte [ ] , byte [ ] > pollNext ( ) throws Exception { synchronized ( lock ) { while ( next == null && error == null ) { lock . wait ( ) ; } ConsumerRecords < byte [ ] , byte [ ] > n = next ; if ( n != null ) { next = null ; lock . notifyAll ( ) ; return n ; } else { ExceptionUtils . rethrowException ( error , error . getMessage ( ) ) ; // this statement cannot be reached since the above method always throws an exception // this is only here to silence the compiler and any warnings return ConsumerRecords . empty ( ) ; } } }
Polls the next element from the Handover possibly blocking until the next element is available . This method behaves similar to polling from a blocking queue .