class AsyncQueryBatchCursor<T> extends java.lang.Object implements AsyncBatchCursor<T>
Modifier and Type | Class and Description |
---|---|
private class |
AsyncQueryBatchCursor.CommandResultSingleResultCallback |
private class |
AsyncQueryBatchCursor.QueryResultSingleResultCallback |
Modifier and Type | Field and Description |
---|---|
private int |
batchSize |
private boolean |
closed |
private AsyncConnectionSource |
connectionSource |
private int |
count |
private ServerCursor |
cursor |
private Decoder<T> |
decoder |
private QueryResult<T> |
firstBatch |
private int |
limit |
private long |
maxTimeMS |
private MongoNamespace |
namespace |
Constructor and Description |
---|
AsyncQueryBatchCursor(QueryResult<T> firstBatch,
int limit,
int batchSize,
Decoder<T> decoder) |
AsyncQueryBatchCursor(QueryResult<T> firstBatch,
int limit,
int batchSize,
long maxTimeMS,
Decoder<T> decoder,
AsyncConnectionSource connectionSource,
AsyncConnection connection) |
Modifier and Type | Method and Description |
---|---|
private BsonDocument |
asGetMoreCommandDocument() |
void |
close() |
int |
getBatchSize()
Gets the batch size to use when requesting the next batch.
|
private void |
getMore(AsyncConnection connection,
SingleResultCallback<java.util.List<T>> callback) |
private void |
getMore(SingleResultCallback<java.util.List<T>> callback) |
(package private) ServerCursor |
getServerCursor() |
private void |
handleGetMoreQueryResult(AsyncConnection connection,
SingleResultCallback<java.util.List<T>> callback,
QueryResult<T> result) |
boolean |
isClosed()
Return true if the AsyncBatchCursor has been closed
|
private void |
killCursor(AsyncConnection connection) |
private void |
killCursorAsynchronouslyAndReleaseConnectionAndSource(AsyncConnection connection,
ServerCursor localCursor,
AsyncConnectionSource localConnectionSource) |
private boolean |
limitReached() |
void |
next(SingleResultCallback<java.util.List<T>> callback)
Returns the next batch of results.
|
void |
setBatchSize(int batchSize)
Sets the batch size to use when requesting the next batch.
|
private final MongoNamespace namespace
private final int limit
private final long maxTimeMS
private volatile AsyncConnectionSource connectionSource
private volatile QueryResult<T> firstBatch
private volatile int batchSize
private volatile ServerCursor cursor
private volatile int count
private volatile boolean closed
AsyncQueryBatchCursor(QueryResult<T> firstBatch, int limit, int batchSize, Decoder<T> decoder)
AsyncQueryBatchCursor(QueryResult<T> firstBatch, int limit, int batchSize, long maxTimeMS, Decoder<T> decoder, AsyncConnectionSource connectionSource, AsyncConnection connection)
public void close()
close
in interface AsyncBatchCursor<T>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void next(SingleResultCallback<java.util.List<T>> callback)
AsyncBatchCursor
next
in interface AsyncBatchCursor<T>
callback
- callback to receive the next batch of resultspublic void setBatchSize(int batchSize)
AsyncBatchCursor
setBatchSize
in interface AsyncBatchCursor<T>
batchSize
- the non-negative batch size. 0 means to use the server default.public int getBatchSize()
AsyncBatchCursor
getBatchSize
in interface AsyncBatchCursor<T>
public boolean isClosed()
AsyncBatchCursor
isClosed
in interface AsyncBatchCursor<T>
ServerCursor getServerCursor()
private boolean limitReached()
private void getMore(SingleResultCallback<java.util.List<T>> callback)
private void getMore(AsyncConnection connection, SingleResultCallback<java.util.List<T>> callback)
private BsonDocument asGetMoreCommandDocument()
private void killCursor(AsyncConnection connection)
private void killCursorAsynchronouslyAndReleaseConnectionAndSource(AsyncConnection connection, ServerCursor localCursor, AsyncConnectionSource localConnectionSource)
private void handleGetMoreQueryResult(AsyncConnection connection, SingleResultCallback<java.util.List<T>> callback, QueryResult<T> result)