@Override public void close() { batchCursor.close(); }
@Override public void close() { wrapped.close(); binding.release(); }
@Nullable @Override public TResult first() { BatchCursor<TResult> batchCursor = getExecutor().execute(operations.findFirst(filter, resultClass, findOptions), getReadPreference(), getReadConcern(), getClientSession()); try { return batchCursor.hasNext() ? batchCursor.next().iterator().next() : null; } finally { batchCursor.close(); } }
<R> R resumeableOperation(final Function<BatchCursor<RawBsonDocument>, R> function) { while (true) { try { return function.apply(wrapped); } catch (Throwable t) { if (!isRetryableError(t)) { throw MongoException.fromThrowableNonNull(t); } } wrapped.close(); if (resumeToken != null) { changeStreamOperation.startOperationTimeForResume(null); changeStreamOperation.resumeAfter(resumeToken); } wrapped = ((ChangeStreamBatchCursor<T>) changeStreamOperation.execute(binding)).getWrapped(); binding.release(); // release the new change stream batch cursor's reference to the binding } } }
@Override public void close() { batchCursor.close(); }
@Override public void close() { batchCursor.close(); }
@Override public void close() { wrapped.close(); binding.release(); }
@Nullable @Override public TResult first() { BatchCursor<TResult> batchCursor = getExecutor().execute(operations.findFirst(filter, resultClass, findOptions), getReadPreference(), getReadConcern(), getClientSession()); try { return batchCursor.hasNext() ? batchCursor.next().iterator().next() : null; } finally { batchCursor.close(); } }
@Nullable @Override public TResult first() { BatchCursor<TResult> batchCursor = getExecutor().execute(operations.findFirst(filter, resultClass, findOptions), getReadPreference(), getReadConcern(), getClientSession()); try { return batchCursor.hasNext() ? batchCursor.next().iterator().next() : null; } finally { batchCursor.close(); } }
<R> R resumeableOperation(final Function<BatchCursor<RawBsonDocument>, R> function) { while (true) { try { return function.apply(wrapped); } catch (Throwable t) { if (!isRetryableError(t)) { throw MongoException.fromThrowableNonNull(t); } } wrapped.close(); if (resumeToken != null) { changeStreamOperation.startOperationTimeForResume(null); changeStreamOperation.resumeAfter(resumeToken); } wrapped = ((ChangeStreamBatchCursor<T>) changeStreamOperation.execute(binding)).getWrapped(); binding.release(); // release the new change stream batch cursor's reference to the binding } } }