Home / Class/ AbstractWeightedFairQueueByteDistributorDependencyTest Class — netty Architecture

AbstractWeightedFairQueueByteDistributorDependencyTest Class — netty Architecture

Architecture documentation for the AbstractWeightedFairQueueByteDistributorDependencyTest class in AbstractWeightedFairQueueByteDistributorDependencyTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b9b7733b_0f6e_c50e_36ac_5bfc3582bcf2["AbstractWeightedFairQueueByteDistributorDependencyTest"]
  823cbd13_1777_cd4c_2c4d_c829c180e654["AbstractWeightedFairQueueByteDistributorDependencyTest.java"]
  b9b7733b_0f6e_c50e_36ac_5bfc3582bcf2 -->|defined in| 823cbd13_1777_cd4c_2c4d_c829c180e654
  d777081e_293e_3f3f_e88d_7165bfdd6fc3["Http2Stream()"]
  b9b7733b_0f6e_c50e_36ac_5bfc3582bcf2 -->|method| d777081e_293e_3f3f_e88d_7165bfdd6fc3
  fb803bf1_8eb0_ccf2_8a51_cb3491520f0b["writeAnswer()"]
  b9b7733b_0f6e_c50e_36ac_5bfc3582bcf2 -->|method| fb803bf1_8eb0_ccf2_8a51_cb3491520f0b
  c08b3d91_7e9f_5071_2c9a_5698e1b5b3a9["initState()"]
  b9b7733b_0f6e_c50e_36ac_5bfc3582bcf2 -->|method| c08b3d91_7e9f_5071_2c9a_5698e1b5b3a9
  3349ccc9_5fd8_debf_40c5_487d17366483["setPriority()"]
  b9b7733b_0f6e_c50e_36ac_5bfc3582bcf2 -->|method| 3349ccc9_5fd8_debf_40c5_487d17366483

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/AbstractWeightedFairQueueByteDistributorDependencyTest.java lines 24–72

abstract class AbstractWeightedFairQueueByteDistributorDependencyTest {
    Http2Connection connection;
    WeightedFairQueueByteDistributor distributor;
    private final IntObjectMap<TestStreamByteDistributorStreamState> stateMap =
            new IntObjectHashMap<TestStreamByteDistributorStreamState>();

    @Mock
    StreamByteDistributor.Writer writer;

    Http2Stream stream(int streamId) {
        return connection.stream(streamId);
    }

    Answer<Void> writeAnswer(final boolean closeIfNoFrame) {
        return new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock in) throws Throwable {
                Http2Stream stream = in.getArgument(0);
                int numBytes = in.getArgument(1);
                TestStreamByteDistributorStreamState state = stateMap.get(stream.id());
                state.pendingBytes -= numBytes;
                state.hasFrame = state.pendingBytes > 0;
                state.isWriteAllowed = state.hasFrame;
                if (closeIfNoFrame && !state.hasFrame) {
                    stream.close();
                }
                distributor.updateStreamableBytes(state);
                return null;
            }
        };
    }

    void initState(final int streamId, final long streamableBytes, final boolean hasFrame) {
        initState(streamId, streamableBytes, hasFrame, hasFrame);
    }

    void initState(final int streamId, final long pendingBytes, final boolean hasFrame,
                              final boolean isWriteAllowed) {
        final Http2Stream stream = stream(streamId);
        TestStreamByteDistributorStreamState state = new TestStreamByteDistributorStreamState(stream, pendingBytes,
                hasFrame, isWriteAllowed);
        stateMap.put(streamId, state);
        distributor.updateStreamableBytes(state);
    }

    void setPriority(int streamId, int parent, int weight, boolean exclusive) throws Http2Exception {
        distributor.updateDependencyTree(streamId, parent, (short) weight, exclusive);
    }
}

Frequently Asked Questions

What is the AbstractWeightedFairQueueByteDistributorDependencyTest class?
AbstractWeightedFairQueueByteDistributorDependencyTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/AbstractWeightedFairQueueByteDistributorDependencyTest.java.
Where is AbstractWeightedFairQueueByteDistributorDependencyTest defined?
AbstractWeightedFairQueueByteDistributorDependencyTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/AbstractWeightedFairQueueByteDistributorDependencyTest.java at line 24.

Analyze Your Own Codebase

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

Try Supermodel Free