Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-650

Provide a CloseableIterator abstraction as a foundation for streaming of results.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.10 RC1 (Fowler)
    • Component/s: Core
    • Labels:
      None

      Description

      In order to add support for Streaming in Spring Data Repositories we need a bit of infrastructure,
      that gives more control over a result than a regular Iterator<T> e.g. being able to
      dispose or close an Iterator in order to release the backing resource.

      Therefore I propose the following abstractions to be added to Spring Data Commons.

      A CloseableIterator which is an Iterator, Closeable and Iterable to serve as
      some kind of bridging data structure for the underlying datastore specific results that can be wrapped in a
      Java 8 Stream.
      For convenient usage in an advanced for-loop we the iterator() method should return this.

      public interface CloseableIterator<T> extends Iterator<T>, Closeable, Iterable<T> {
      
      	/**
      	 * Closes this iterator, freeing any resources created.
      	 */
      	@Override
      	void close();
      
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thomasd Thomas Darimont
              Reporter:
              thomasd Thomas Darimont
              Last updater:
              Mohsin Husen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: