Skip to content

Commit c5035a9

Browse files
committed
JAVA-2778: Release binding after retrying a change stream operation
1 parent ff5db74 commit c5035a9

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

driver-core/src/main/com/mongodb/operation/AsyncChangeStreamBatchCursor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public void onResult(final AsyncBatchCursor<T> result, final Throwable t) {
124124
callback.onResult(null, t);
125125
} else {
126126
wrapped = ((AsyncChangeStreamBatchCursor<T>) result).getWrapped();
127+
binding.release(); // release the new change stream batch cursor's reference to the binding
127128
asyncBlock.apply(wrapped, callback);
128129
}
129130
}

driver-core/src/main/com/mongodb/operation/ChangeStreamBatchCursor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ <R> R resumeableOperation(final Function<BatchCursor<RawBsonDocument>, R> functi
138138
}
139139
wrapped.close();
140140
wrapped = ((ChangeStreamBatchCursor<T>) changeStreamOperation.resumeAfter(resumeToken).execute(binding)).getWrapped();
141+
binding.release(); // release the new change stream batch cursor's reference to the binding
141142
return function.apply(wrapped);
142143
}
143144

0 commit comments

Comments
 (0)