Class Scrolling.AutoClosingIterator

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.util.Iterator<ElasticsearchJson.Result>
    Enclosing class:
    Scrolling

    private static class Scrolling.AutoClosingIterator
    extends java.lang.Object
    implements java.util.Iterator<ElasticsearchJson.Result>, java.lang.AutoCloseable
    Observes when existing iterator has ended and clears context (scroll) if any.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean closed
      Returns whether closer consumer was already called.
      private java.util.function.Consumer<java.lang.String> closer  
      private java.util.Iterator<ElasticsearchJson.Result> delegate  
      private java.lang.String scrollId
      Keeps last value of scrollId in memory so scroll can be released upon termination
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean hasNext()  
      ElasticsearchJson.Result next()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Field Detail

      • closer

        private final java.util.function.Consumer<java.lang.String> closer
      • closed

        private boolean closed
        Returns whether closer consumer was already called.
      • scrollId

        private java.lang.String scrollId
        Keeps last value of scrollId in memory so scroll can be released upon termination
    • Constructor Detail

      • AutoClosingIterator

        private AutoClosingIterator​(java.util.Iterator<ElasticsearchJson.Result> delegate,
                                    java.util.function.Consumer<java.lang.String> closer)