-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
RetainableByteBuffer as mutable #11801
Conversation
Small tweaks to the RBB API to make the concept more uniform throughout the codebase.
Small tweaks to the RBB API to make the concept more uniform throughout the codebase.
Too much noise in this PR. Will make another PR for it.
@lorban Can you quickly go through and resolve any questions that you think are well enough answered? |
@gregw the only point of contention I see is the behavior of But this caught me by surprise, and I assume it could again in the future, more so if we multiply the exceptions. So I think there should be some hint in the method's name that it's not playing by the rules to suggest the caller of that API to go read the javadoc. How about renaming |
@lorban I too was caught by surprise that we already have some accumulators that have this semantic behind a method called
I'm open to change the name, but I don't like |
# Conflicts: # jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java # jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ChunkAccumulator.java
…r.DynamicCapacity Signed-off-by: Ludovic Orban <lorban@bitronix.be>
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 are a few nits left (see my comments) and I took care of a few TODOs related to usages of the deprecated ByteBufferPool.Accumulator
, otherwise this looks like a good step forward.
@@ -581,14 +581,19 @@ private Pool.Entry<RetainableByteBuffer> evict() | |||
} | |||
} | |||
|
|||
private static class Buffer extends AbstractRetainableByteBuffer | |||
private static class PooledBuffer extends RetainableByteBuffer.Pooled |
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.
Almost only ArrayByteBufferPool
makes use of this class so it could be made private for that purpose.
The only other usage is DynamicCapacity.takeByteArray()
which prevents getting the array if the buffer is pooled, but that check contrasts with getByteBuffer()
which does no such check.
I don't like very much this class being exposed as part of the buffer API,
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/IOResources.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java
Outdated
Show resolved
Hide resolved
…r.DynamicCapacity Signed-off-by: Ludovic Orban <lorban@bitronix.be>
…r.DynamicCapacity Signed-off-by: Ludovic Orban <lorban@bitronix.be>
…r.DynamicCapacity Signed-off-by: Ludovic Orban <lorban@bitronix.be>
I also noticed that tests inheriting from |
@lorban I think this is good to merge and get some prime time usage!?!?! no? 12.1.x will not be final for a while, so there is still time to make changes |
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 agree to get this merged into 12.1.x.
There still are things that need to be cleaned up, and others that may be done differently but this is going to the right direction, already improves the current state and already is a large and complex PR.
@lorban I have merged. Can you open issues for the things you want us to investigate more |
@gregw I've opened the 5 enhancements listed above. AFAICS, we can consider this RBB refactoring is done once those are tackled. |
Opening this PR against 12.1.x rather than 12.0.x, replacing #11598
I'm just going to summarize the objectives of this PR: