T
- The type of documents the cursor containsAutoCloseable
, Closeable
, Iterator<List<T>>
MapReduceBatchCursor<T>
@NotThreadSafe public interface BatchCursor<T> extends Iterator<List<T>>, Closeable
next
method will return the first batch, and subsequent calls will trigger a request to get the next batch
of results. Clients can control the batch size by setting the batchSize
property between calls to next
.Modifier and Type | Method | Description |
---|---|---|
void |
closeβ() |
|
int |
getBatchSizeβ() |
Gets the batch size to use when requesting the next batch.
|
ServerAddress |
getServerAddressβ() |
Returns the server address
|
ServerCursor |
getServerCursorβ() |
Returns the server cursor
|
boolean |
hasNextβ() |
Returns true if another batch of results exists.
|
List<T> |
nextβ() |
Returns the next batch of results.
|
void |
setBatchSizeβ(int batchSize) |
Sets the batch size to use when requesting the next batch.
|
List<T> |
tryNextβ() |
A special
next() case that returns the next batch if available or null. |
forEachRemaining, remove
void closeβ()
close
in interface AutoCloseable
close
in interface Closeable
boolean hasNextβ()
List<T> nextβ()
next
in interface Iterator<T>
NoSuchElementException
- if no next batch existsvoid setBatchSizeβ(int batchSize)
batchSize
- the non-negative batch size. 0 means to use the server default.int getBatchSizeβ()
List<T> tryNextβ()
next()
case that returns the next batch if available or null.
Tailable cursors are an example where this is useful. A call to tryNext()
may return null, but in the future calling
tryNext()
would return a new batch if a document had been added to the capped collection.
ServerCursor getServerCursorβ()
ServerAddress getServerAddressβ()