-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
InternalStreamConnection
must release buffers obtained via ByteBufferBsonOutput.getByteBuffers
#1160
Conversation
…ferBsonOutput.getByteBuffers` JAVA-5084
driver-core/src/main/com/mongodb/internal/connection/InternalStreamConnection.java
Show resolved
Hide resolved
@@ -46,7 +46,8 @@ public interface Stream extends BufferProvider{ | |||
/** | |||
* Write each buffer in the list to the stream in order, blocking until all are completely written. | |||
* | |||
* @param buffers the buffers to write | |||
* @param buffers the buffers to write. The operation must not {@linkplain ByteBuf#release() release} any buffer from {@code buffers}, | |||
* unless it also {@linkplain ByteBuf#retain() retained} it, and releasing is meant to compensate for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change, right? If a third party had written something like NettyStream
, it would now be broken with the change to InternalStreamConnection
.
I have never heard of anyone actually writing their own Stream
implementation, so it's not likely to affect anyone in practice, but it should at least make the release notes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok even in a minor release. Just mark the JAVA ticket as Docs Changed Needed so we get something in the release notes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I documented the required doc change in the "Documentation Changes Summary" in https://jira.mongodb.org/browse/DOCSP-31709.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -46,7 +46,8 @@ public interface Stream extends BufferProvider{ | |||
/** | |||
* Write each buffer in the list to the stream in order, blocking until all are completely written. | |||
* | |||
* @param buffers the buffers to write | |||
* @param buffers the buffers to write. The operation must not {@linkplain ByteBuf#release() release} any buffer from {@code buffers}, | |||
* unless it also {@linkplain ByteBuf#retain() retained} it, and releasing is meant to compensate for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok even in a minor release. Just mark the JAVA ticket as Docs Changed Needed so we get something in the release notes.
JAVA-5084