Home / Function/ setup() — netty Function Reference

setup() — netty Function Reference

Architecture documentation for the setup() function in HttpRequestEncoderBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6fe9d6dc_40e8_db94_6ffa_4037c27133b5["setup()"]
  8879ea80_f499_de37_89e2_c6faf236521a["HttpRequestEncoderBenchmark"]
  6fe9d6dc_40e8_db94_6ffa_4037c27133b5 -->|defined in| 8879ea80_f499_de37_89e2_c6faf236521a
  92606a59_73fb_4bab_78bb_ebea94d7f655["differentTypes()"]
  6fe9d6dc_40e8_db94_6ffa_4037c27133b5 -->|calls| 92606a59_73fb_4bab_78bb_ebea94d7f655
  style 6fe9d6dc_40e8_db94_6ffa_4037c27133b5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/http/HttpRequestEncoderBenchmark.java lines 76–108

    @Setup(Level.Trial)
    public void setup() throws Exception {
        byte[] bytes = new byte[contentBytes];
        content = Unpooled.buffer(bytes.length);
        content.writeBytes(bytes);
        ByteBuf testContent = Unpooled.unreleasableBuffer(content.asReadOnly());
        DefaultHttpHeadersFactory headersFactory = DefaultHttpHeadersFactory.headersFactory().withValidation(false);
        HttpHeaders headersWithChunked = headersFactory.newHeaders();
        headersWithChunked.add(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
        HttpHeaders headersWithContentLength = headersFactory.newHeaders();
        headersWithContentLength.add(HttpHeaderNames.CONTENT_LENGTH, testContent.readableBytes());

        fullRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/index", testContent,
                headersWithContentLength, EmptyHttpHeaders.INSTANCE);
        contentLengthRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/index",
                headersWithContentLength);
        chunkedRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/index", headersWithChunked);
        lastContent = new DefaultLastHttpContent(testContent, headersFactory);

        encoder = new HttpRequestEncoder();
        context = new EmbeddedChannelWriteReleaseHandlerContext(pooledAllocator ? PooledByteBufAllocator.DEFAULT :
                UnpooledByteBufAllocator.DEFAULT, encoder) {
            @Override
            protected void handleException(Throwable t) {
                handleUnexpectedException(t);
            }
        };
        if (typePollution) {
            for (int i = 0; i < 20000; i++) {
                differentTypes();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does setup() do?
setup() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/http/HttpRequestEncoderBenchmark.java.
Where is setup() defined?
setup() is defined in microbench/src/main/java/io/netty/microbench/http/HttpRequestEncoderBenchmark.java at line 76.
What does setup() call?
setup() calls 1 function(s): differentTypes.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free