Class ChunkingIterator<T>

java.lang.Object
com.googlecode.objectify.impl.ChunkingIterator<T>
All Implemented Interfaces:
com.google.appengine.api.datastore.QueryResultIterator<T>, Iterator<T>

public class ChunkingIterator<T>
extends Object
implements com.google.appengine.api.datastore.QueryResultIterator<T>
Base class for normal and hybrid iterators, handles the chunking logic. The bulk of the complexity is in the QueryResultStreamIterator; this just handles stripping out null values but being careful about preserving cursor behavior.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChunkingIterator​(LoadEngine loadEngine, com.google.appengine.api.datastore.PreparedQuery pq, com.google.appengine.api.datastore.QueryResultIterator<Key<T>> source, int chunkSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.appengine.api.datastore.Cursor
    From Alfred Fuller (principal GAE datastore guru): Calling getCursor() for results in the middle of a batch forces the sdk to run a new query as seen here: http://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/datastore/Cursor.java#70 Doing this for every result will definitely give you really bad performance.
    List<com.google.appengine.api.datastore.Index>
     
    boolean
     
     
    void
    Not implemented

    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
  • Constructor Details

    • ChunkingIterator

      public ChunkingIterator(LoadEngine loadEngine, com.google.appengine.api.datastore.PreparedQuery pq, com.google.appengine.api.datastore.QueryResultIterator<Key<T>> source, int chunkSize)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • remove

      public void remove()
      Not implemented
      Specified by:
      remove in interface Iterator<T>
    • getCursor

      public com.google.appengine.api.datastore.Cursor getCursor()
      From Alfred Fuller (principal GAE datastore guru): Calling getCursor() for results in the middle of a batch forces the sdk to run a new query as seen here: http://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/datastore/Cursor.java#70 Doing this for every result will definitely give you really bad performance. I have several yet to be implemented ideas that would solve this problem (which you potentially could push me into prioritizing), but I believe you can solve the performance problem today by saving the start_cursor an offset into the batch. Then you can evaluate the real cursor on demand using "query.asQueryResultIterator(withStartCursor(cursor).offset(n).limit(0)).getCursor()"
      Specified by:
      getCursor in interface com.google.appengine.api.datastore.QueryResultIterator<T>
    • getIndexList

      public List<com.google.appengine.api.datastore.Index> getIndexList()
      Specified by:
      getIndexList in interface com.google.appengine.api.datastore.QueryResultIterator<T>