Search in sources :

Example 6 with EmbeddedChannelWriteReleaseHandlerContext

use of io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext in project netty by netty.

the class StompEncoderBenchmark method setup.

@Setup(Level.Trial)
public void setup() {
    byte[] bytes = new byte[contentLength];
    ThreadLocalRandom.current().nextBytes(bytes);
    content = Unpooled.wrappedBuffer(bytes);
    ByteBuf testContent = Unpooled.unreleasableBuffer(content.asReadOnly());
    StompHeadersSubframe headersSubframe = ExampleStompHeadersSubframe.EXAMPLES.get(headersType);
    stompFrame = new DefaultStompFrame(headersSubframe.command(), testContent);
    stompFrame.headers().setAll(headersSubframe.headers());
    stompEncoder = new StompSubframeEncoder();
    context = new EmbeddedChannelWriteReleaseHandlerContext(pooledAllocator ? PooledByteBufAllocator.DEFAULT : UnpooledByteBufAllocator.DEFAULT, stompEncoder) {

        @Override
        protected void handleException(Throwable t) {
            handleUnexpectedException(t);
        }
    };
}
Also used : StompHeadersSubframe(io.netty.handler.codec.stomp.StompHeadersSubframe) EmbeddedChannelWriteReleaseHandlerContext(io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext) ByteBuf(io.netty.buffer.ByteBuf) StompSubframeEncoder(io.netty.handler.codec.stomp.StompSubframeEncoder) DefaultStompFrame(io.netty.handler.codec.stomp.DefaultStompFrame) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

EmbeddedChannelWriteReleaseHandlerContext (io.netty.microbench.channel.EmbeddedChannelWriteReleaseHandlerContext)6 Setup (org.openjdk.jmh.annotations.Setup)5 ByteBuf (io.netty.buffer.ByteBuf)3 DefaultHttp2Connection (io.netty.handler.codec.http2.DefaultHttp2Connection)2 Http2ConnectionHandler (io.netty.handler.codec.http2.Http2ConnectionHandler)2 Http2ConnectionHandlerBuilder (io.netty.handler.codec.http2.Http2ConnectionHandlerBuilder)2 Http2FrameAdapter (io.netty.handler.codec.http2.Http2FrameAdapter)2 ByteBufAllocator (io.netty.buffer.ByteBufAllocator)1 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)1 UnpooledByteBufAllocator (io.netty.buffer.UnpooledByteBufAllocator)1 ChannelInboundHandlerAdapter (io.netty.channel.ChannelInboundHandlerAdapter)1 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)1 DefaultHttpHeaders (io.netty.handler.codec.http.DefaultHttpHeaders)1 DefaultHttpRequest (io.netty.handler.codec.http.DefaultHttpRequest)1 DefaultLastHttpContent (io.netty.handler.codec.http.DefaultLastHttpContent)1 EmptyHttpHeaders (io.netty.handler.codec.http.EmptyHttpHeaders)1 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)1 HttpRequestEncoder (io.netty.handler.codec.http.HttpRequestEncoder)1 DefaultHttp2ConnectionDecoder (io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder)1 DefaultHttp2ConnectionEncoder (io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder)1