ChannelFuture() — netty Function Reference
Architecture documentation for the ChannelFuture() function in CompressorHttp2ConnectionEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 379ae9ad_6cf0_7b95_0348_d4a8f9f0c7c1["ChannelFuture()"] 8d787c1c_5f3d_4d80_1537_18462b224aaf["CompressorHttp2ConnectionEncoder"] 379ae9ad_6cf0_7b95_0348_d4a8f9f0c7c1 -->|defined in| 8d787c1c_5f3d_4d80_1537_18462b224aaf c2a3977b_4edd_973b_0b72_4eff08ff08ac["cleanup()"] 379ae9ad_6cf0_7b95_0348_d4a8f9f0c7c1 -->|calls| c2a3977b_4edd_973b_0b72_4eff08ff08ac 05f589c3_391d_c20c_d485_95f6c4f2230c["bindCompressorToStream()"] 379ae9ad_6cf0_7b95_0348_d4a8f9f0c7c1 -->|calls| 05f589c3_391d_c20c_d485_95f6c4f2230c style 379ae9ad_6cf0_7b95_0348_d4a8f9f0c7c1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java lines 176–231
@Override
public ChannelFuture writeData(final ChannelHandlerContext ctx, final int streamId, ByteBuf data, int padding,
final boolean endOfStream, ChannelPromise promise) {
final Http2Stream stream = connection().stream(streamId);
final EmbeddedChannel channel = stream == null ? null : (EmbeddedChannel) stream.getProperty(propertyKey);
if (channel == null) {
// The compressor may be null if no compatible encoding type was found in this stream's headers
return super.writeData(ctx, streamId, data, padding, endOfStream, promise);
}
try {
// The channel will release the buffer after being written
channel.writeOutbound(data);
ByteBuf buf = nextReadableBuf(channel);
if (buf == null) {
if (endOfStream) {
if (channel.finish()) {
buf = nextReadableBuf(channel);
}
return super.writeData(ctx, streamId, buf == null ? Unpooled.EMPTY_BUFFER : buf, padding,
true, promise);
}
// END_STREAM is not set and the assumption is data is still forthcoming.
promise.setSuccess();
return promise;
}
PromiseCombiner combiner = new PromiseCombiner(ctx.executor());
for (;;) {
ByteBuf nextBuf = nextReadableBuf(channel);
boolean compressedEndOfStream = nextBuf == null && endOfStream;
if (compressedEndOfStream && channel.finish()) {
nextBuf = nextReadableBuf(channel);
compressedEndOfStream = nextBuf == null;
}
ChannelPromise bufPromise = ctx.newPromise();
combiner.add(bufPromise);
super.writeData(ctx, streamId, buf, padding, compressedEndOfStream, bufPromise);
if (nextBuf == null) {
break;
}
padding = 0; // Padding is only communicated once on the first iteration
buf = nextBuf;
}
combiner.finish(promise);
} catch (Throwable cause) {
promise.tryFailure(cause);
} finally {
if (endOfStream) {
cleanup(stream, channel);
}
}
return promise;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does ChannelFuture() do?
ChannelFuture() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java.
Where is ChannelFuture() defined?
ChannelFuture() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java at line 176.
What does ChannelFuture() call?
ChannelFuture() calls 2 function(s): bindCompressorToStream, cleanup.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free