EmbeddedChannelWriteAccumulatingHandlerContext Class — netty Architecture
Architecture documentation for the EmbeddedChannelWriteAccumulatingHandlerContext class in EmbeddedChannelWriteAccumulatingHandlerContext.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b27e7e4f_6a18_a6f3_4406_3a2031589745["EmbeddedChannelWriteAccumulatingHandlerContext"] 7b6eb620_eae4_9832_263e_c004c2657e54["EmbeddedChannelWriteAccumulatingHandlerContext.java"] b27e7e4f_6a18_a6f3_4406_3a2031589745 -->|defined in| 7b6eb620_eae4_9832_263e_c004c2657e54 135cf5bc_8a4f_f3f9_59df_914937427bae["EmbeddedChannelWriteAccumulatingHandlerContext()"] b27e7e4f_6a18_a6f3_4406_3a2031589745 -->|method| 135cf5bc_8a4f_f3f9_59df_914937427bae f5306720_80c6_abec_4b61_55e67ba17d7e["ByteBuf()"] b27e7e4f_6a18_a6f3_4406_3a2031589745 -->|method| f5306720_80c6_abec_4b61_55e67ba17d7e 6d215a30_4347_7de4_8232_60d617283379["releaseCumulation()"] b27e7e4f_6a18_a6f3_4406_3a2031589745 -->|method| 6d215a30_4347_7de4_8232_60d617283379 d570252d_fd6f_64dc_c4a9_12eb33648d1c["ChannelFuture()"] b27e7e4f_6a18_a6f3_4406_3a2031589745 -->|method| d570252d_fd6f_64dc_c4a9_12eb33648d1c
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/channel/EmbeddedChannelWriteAccumulatingHandlerContext.java lines 26–103
public abstract class EmbeddedChannelWriteAccumulatingHandlerContext extends EmbeddedChannelHandlerContext {
private ByteBuf cumulation;
private final ByteToMessageDecoder.Cumulator cumulator;
protected EmbeddedChannelWriteAccumulatingHandlerContext(ByteBufAllocator alloc, ChannelHandler handler,
ByteToMessageDecoder.Cumulator writeCumulator) {
this(alloc, handler, writeCumulator, new EmbeddedChannel());
}
protected EmbeddedChannelWriteAccumulatingHandlerContext(ByteBufAllocator alloc, ChannelHandler handler,
ByteToMessageDecoder.Cumulator writeCumulator,
EmbeddedChannel channel) {
super(alloc, handler, channel);
this.cumulator = ObjectUtil.checkNotNull(writeCumulator, "writeCumulator");
}
public final ByteBuf cumulation() {
return cumulation;
}
public final void releaseCumulation() {
if (cumulation != null) {
cumulation.release();
cumulation = null;
}
}
@Override
public final ChannelFuture write(Object msg) {
return write(msg, newPromise());
}
@Override
public final ChannelFuture write(Object msg, ChannelPromise promise) {
try {
if (msg instanceof ByteBuf) {
if (cumulation == null) {
cumulation = (ByteBuf) msg;
} else {
cumulation = cumulator.cumulate(alloc(), cumulation, (ByteBuf) msg);
}
promise.setSuccess();
} else {
channel().write(msg, promise);
}
} catch (Exception e) {
promise.setFailure(e);
handleException(e);
}
return promise;
}
@Override
public final ChannelFuture writeAndFlush(Object msg, ChannelPromise promise) {
try {
if (msg instanceof ByteBuf) {
ByteBuf buf = (ByteBuf) msg;
if (cumulation == null) {
cumulation = buf;
} else {
cumulation = cumulator.cumulate(alloc(), cumulation, buf);
}
promise.setSuccess();
} else {
channel().writeAndFlush(msg, promise);
}
} catch (Exception e) {
promise.setFailure(e);
handleException(e);
}
return promise;
}
@Override
public final ChannelFuture writeAndFlush(Object msg) {
return writeAndFlush(msg, newPromise());
}
}
Source
Frequently Asked Questions
What is the EmbeddedChannelWriteAccumulatingHandlerContext class?
EmbeddedChannelWriteAccumulatingHandlerContext is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/channel/EmbeddedChannelWriteAccumulatingHandlerContext.java.
Where is EmbeddedChannelWriteAccumulatingHandlerContext defined?
EmbeddedChannelWriteAccumulatingHandlerContext is defined in microbench/src/main/java/io/netty/microbench/channel/EmbeddedChannelWriteAccumulatingHandlerContext.java at line 26.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free