Skip to content
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

ByteChannelContentSource #11910

Merged
merged 14 commits into from
Jun 24, 2024
Merged

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Jun 12, 2024

This PR introduces a ByteChannelContentSource which is needed for the spring framework integration.

It also introduces a few minor utilities:

  • a ByteBufferPool.Sized class that is a ByteBufferPool.Wrapper with a configured size and type so a no args acquire() method can be called. This avoid the need to many classes to have a three fields: pool, size and direct and also can avoid constructors/methods with size and direct
  • an ExceptionUtil.run(Runnable, Consumer<Throwable> failure) that is a simple try catch and avoids many private methods being created to do just that.

@lachlan-roberts
Copy link
Contributor

@gregw I looked at the ContentWriterIteratingCallback from the spring PR, and it looks like we already have something very similar, org.eclipse.jetty.io.IOResources.PathToSinkCopier which is used from IOResources#copy(Resource, Content.Sink, ByteBufferPool, int, boolean, long, long, Callback).

So considering we already have this do we really need the ByteChannelContentSource at all?

@gregw gregw requested a review from lorban June 12, 2024 11:53
lorban
lorban previously approved these changes Jun 17, 2024
Reverted PathContentSource to previous implementation, but with deprecated methods
Simplified ByteChannelContentSource
more rewind tests.
@gregw gregw dismissed sbordet’s stale review June 18, 2024 23:25

@sbordet is on vacation. @lorban will review

@gregw
Copy link
Contributor Author

gregw commented Jun 18, 2024

@lorban I have met @sbordet's review as much as I can. Can you please re-review this ASAP!

Reverted PathContentSource to previous implementation, but with deprecated methods
Simplified ByteChannelContentSource
more rewind tests.
@gregw
Copy link
Contributor Author

gregw commented Jun 19, 2024

@lachlan-roberts can you review this in light of @sbordet being on vacation. Can you check if I have addressed all his points sufficiently.
Note that @lorban has previously given this the green tick, before the changes requested by @sbordet (but didn't re-review yesterday).

@gregw gregw merged commit 4f4bec0 into jetty-12.0.x Jun 24, 2024
10 checks passed
@gregw gregw deleted the jetty-12.0.x-ByteChannelContentSource branch June 24, 2024 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants