private void killCursorAsynchronouslyAndReleaseConnectionAndSource(final AsyncConnection connection, final ServerCursor localCursor) { if (serverIsAtLeastVersionThreeDotTwo(connection.getDescription())) { connection.commandAsync(namespace.getDatabaseName(), asKillCursorsCommandDocument(localCursor), NO_OP_FIELD_NAME_VALIDATOR, ReadPreference.primary(), new BsonDocumentCodec(), connectionSource.getSessionContext(), new SingleResultCallback<BsonDocument>() { @Override public void onResult(final BsonDocument result, final Throwable t) { connection.release(); connectionSource.release(); } }); } else { connection.killCursorAsync(namespace, singletonList(localCursor.getId()), new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { connection.release(); connectionSource.release(); } }); } }
private void getMore(final AsyncConnection connection, final ServerCursor cursor, final SingleResultCallback<List<T>> callback, final boolean tryNext) { if (serverIsAtLeastVersionThreeDotTwo(connection.getDescription())) { connection.commandAsync(namespace.getDatabaseName(), asGetMoreCommandDocument(cursor.getId()), NO_OP_FIELD_NAME_VALIDATOR, ReadPreference.primary(), CommandResultDocumentCodec.create(decoder, "nextBatch"), connectionSource.getSessionContext(), new CommandResultSingleResultCallback(connection, cursor, callback, tryNext)); } else { connection.getMoreAsync(namespace, cursor.getId(), getNumberToReturn(limit, batchSize, count.get()), decoder, new QueryResultSingleResultCallback(connection, callback, tryNext)); } }
private void killCursorAsynchronouslyAndReleaseConnectionAndSource(final AsyncConnection connection, final ServerCursor localCursor) { if (serverIsAtLeastVersionThreeDotTwo(connection.getDescription())) { connection.commandAsync(namespace.getDatabaseName(), asKillCursorsCommandDocument(localCursor), NO_OP_FIELD_NAME_VALIDATOR, ReadPreference.primary(), new BsonDocumentCodec(), connectionSource.getSessionContext(), new SingleResultCallback<BsonDocument>() { @Override public void onResult(final BsonDocument result, final Throwable t) { connection.release(); connectionSource.release(); } }); } else { connection.killCursorAsync(namespace, singletonList(localCursor.getId()), new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { connection.release(); connectionSource.release(); } }); } }
private void getMore(final AsyncConnection connection, final ServerCursor cursor, final SingleResultCallback<List<T>> callback, final boolean tryNext) { if (serverIsAtLeastVersionThreeDotTwo(connection.getDescription())) { connection.commandAsync(namespace.getDatabaseName(), asGetMoreCommandDocument(cursor.getId()), NO_OP_FIELD_NAME_VALIDATOR, ReadPreference.primary(), CommandResultDocumentCodec.create(decoder, "nextBatch"), connectionSource.getSessionContext(), new CommandResultSingleResultCallback(connection, cursor, callback, tryNext)); } else { connection.getMoreAsync(namespace, cursor.getId(), getNumberToReturn(limit, batchSize, count.get()), decoder, new QueryResultSingleResultCallback(connection, callback, tryNext)); } }