Skip to content

Port: Codec-compression: Add BrotliDecompressor - #17171

Merged
chrisvest merged 8 commits into
netty:5.0from
chrisvest:5.0-brotli-decompressor
Aug 10, 2026
Merged

chrisvest merged 8 commits into
netty:5.0from
chrisvest:5.0-brotli-decompressor

Conversation

@chrisvest

Copy link
Copy Markdown
Member

Motivation:

The decompressor API migration tracked in #16743 needs per-format
implementations split into independently reviewable changes. Brotli
support is one of the remaining formats after the core decompressor API
landed in #16745.

Modification:

  • Add BrotliDecompressor using the new Decompressor API.
  • Add BrotliDecompressorTest using the shared decompressor contract
    tests.
  • Fix BrotliEncoder close handling so the finish future returned
    during close is completed by the writer.

Result:

Brotli now has a reusable decompressor implementation that can be used
without a channel-based decoder, and the codec-compression module
verifies successfully.

Part of #16743.


Co-authored-by: multicode [email protected]

(cherry picked from commit b8fb58f)

yawkat and others added 2 commits July 28, 2026 11:45
Motivation:

The decompressor API migration tracked in netty#16743 needs per-format
implementations split into independently reviewable changes. Brotli
support is one of the remaining formats after the core decompressor API
landed in netty#16745.

Modification:

- Add `BrotliDecompressor` using the new `Decompressor` API.
- Add `BrotliDecompressorTest` using the shared decompressor contract
tests.
- Fix `BrotliEncoder` close handling so the finish future returned
during close is completed by the writer.

Result:

Brotli now has a reusable decompressor implementation that can be used
without a channel-based decoder, and the codec-compression module
verifies successfully.

Part of netty#16743.

---------

Co-authored-by: multicode <[email protected]>

(cherry picked from commit b8fb58f)
@chrisvest chrisvest added this to the 5.0.0.Final milestone Jul 28, 2026
@chrisvest
chrisvest requested a review from yawkat July 28, 2026 18:59
@chrisvest

Copy link
Copy Markdown
Member Author

@yawkat Had to redo the BrotliEncoder changes for 5.0.

@yawkat
yawkat requested a review from Copilot July 28, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds Brotli support to the new Decompressor API and aligns Brotli encoder shutdown semantics with the channel writer’s completion lifecycle.

Changes:

  • Introduce BrotliDecompressor implementing the new Decompressor API (with a builder).
  • Add BrotliDecompressorTest based on the shared decompressor contract tests.
  • Fix BrotliEncoder close/finish handling so the close promise is completed by the writer.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
codec-compression/src/main/java/io/netty/handler/codec/compression/BrotliDecompressor.java New reusable Brotli decompressor implementation using DecoderJNI.Wrapper.
codec-compression/src/test/java/io/netty/handler/codec/compression/BrotliDecompressorTest.java Contract-style tests for Brotli decompression behavior and edge conditions.
codec-compression/src/main/java/io/netty/handler/codec/compression/BrotliEncoder.java Adjusts close/finish wiring so close completion is driven by the writer’s finish future.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 191 to 193
private final ChannelHandlerContext ctx;
private final Promise<Void> closeFuture;
private boolean isClosed;
Comment on lines 246 to 254
public void close() {
final Promise<Void> promise = ctx.newPromise();

ctx.executor().execute(new Runnable() {
@Override
public void run() {
try {
finish(promise);
} catch (IOException ex) {
promise.setFailure(new IllegalStateException("Failed to finish encoding", ex));
}
ctx.executor().execute(() -> {
try {
finish(closeFuture);
} catch (IOException ex) {
closeFuture.setFailure(new IllegalStateException("Failed to finish encoding", ex));
}
});
}
@yawkat

yawkat commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

fixed the same issue in #17175

@chrisvest
chrisvest enabled auto-merge (squash) August 4, 2026 22:42
@chrisvest

Copy link
Copy Markdown
Member Author

Ok, I think this should pass now.

@testlens-app

testlens-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: edfc7c6
▶️ Tests: 40743 executed
⚪️ Checks: 12/12 completed


Learn more about TestLens at testlens.app.

@chrisvest
chrisvest disabled auto-merge August 10, 2026 18:41
@chrisvest
chrisvest merged commit 8692f4d into netty:5.0 Aug 10, 2026
12 of 13 checks passed
@chrisvest
chrisvest deleted the 5.0-brotli-decompressor branch August 10, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants