Skip to content

Check resourceManager state first in getMoreLoop #1439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import static com.mongodb.assertions.Assertions.assertNotNull;
import static com.mongodb.assertions.Assertions.assertNull;
import static com.mongodb.assertions.Assertions.assertTrue;
import static com.mongodb.assertions.Assertions.fail;
import static com.mongodb.internal.Locks.withLock;
import static com.mongodb.internal.operation.CommandBatchCursorHelper.MESSAGE_IF_CONCURRENT_OPERATION;
Expand Down Expand Up @@ -220,15 +218,15 @@ ServerCursor getServerCursor() {
return serverCursor;
}

void setServerCursor(@Nullable final ServerCursor serverCursor) {
assertTrue(state.inProgress());
assertNotNull(this.serverCursor);
// without `connectionSource` we will not be able to kill `serverCursor` later
assertNotNull(connectionSource);
this.serverCursor = serverCursor;
if (serverCursor == null) {
releaseClientResources();
}
void setServerCursor(@Nullable final ServerCursor nextServerCursor) {
withLock(lock, () -> {
if (state.inProgress() && serverCursor != null) {
serverCursor = nextServerCursor;
}
if (serverCursor == null) {
releaseClientResources();
}
});
}

void unsetServerCursor() {
Expand Down