Home / Class/ WeightedFairQueueByteDistributorDependencyTreeTest Class — netty Architecture

WeightedFairQueueByteDistributorDependencyTreeTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  f59fdba5_c411_919e_8d09_ef11c6679e0d["WeightedFairQueueByteDistributorDependencyTreeTest"]
  3c2a49bb_3723_51ee_704f_fcd378405b75["WeightedFairQueueByteDistributorDependencyTreeTest.java"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|defined in| 3c2a49bb_3723_51ee_704f_fcd378405b75
  57fc268f_ff1d_75b5_06df_6fd94e9fd09c["setup()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 57fc268f_ff1d_75b5_06df_6fd94e9fd09c
  e84620de_0831_789e_d7e8_6378701b5251["closingStreamWithChildrenDoesNotCauseConcurrentModification()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| e84620de_0831_789e_d7e8_6378701b5251
  ec73cc64_7a99_abb0_93c9_2c2c5ef674d8["closeWhileIteratingDoesNotNPE()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| ec73cc64_7a99_abb0_93c9_2c2c5ef674d8
  8bbc8d35_cbf0_3a85_7191_fe9c05bccd79["localStreamCanDependUponIdleStream()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 8bbc8d35_cbf0_3a85_7191_fe9c05bccd79
  40397944_b060_9fe5_ff68_e0c995665028["remoteStreamCanDependUponIdleStream()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 40397944_b060_9fe5_ff68_e0c995665028
  2ee591ec_4aac_c078_e893_6c6ac1a7d129["prioritizeShouldUseDefaults()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 2ee591ec_4aac_c078_e893_6c6ac1a7d129
  b2742d7d_0a2a_af04_7a99_227c781bcf8f["reprioritizeWithNoChangeShouldDoNothing()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| b2742d7d_0a2a_af04_7a99_227c781bcf8f
  381f804b_d2b2_b069_9b73_cde86465fca2["stateOnlyPriorityShouldBePreservedWhenStreamsAreCreatedAndClosed()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 381f804b_d2b2_b069_9b73_cde86465fca2
  1c5f645f_d21e_09ad_9b15_1c56244ea330["verifyStateOnlyPriorityShouldBePreservedWhenStreamsAreCreated()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 1c5f645f_d21e_09ad_9b15_1c56244ea330
  60aa764a_c5b7_3fcc_4f08_647f77b7de6a["fireFoxQoSStreamsRemainAfterDataStreamsAreClosed()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 60aa764a_c5b7_3fcc_4f08_647f77b7de6a
  9bb14600_992d_861f_4dbc_b1c448deadfa["verifyFireFoxQoSStreams()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 9bb14600_992d_861f_4dbc_b1c448deadfa
  7fd9f674_a3db_2f86_0b71_15955386dcef["lowestPrecedenceStateShouldBeDropped()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 7fd9f674_a3db_2f86_0b71_15955386dcef
  6db50b9d_1b80_9b58_97b2_d49cee054cf2["verifyLowestPrecedenceStateShouldBeDropped1()"]
  f59fdba5_c411_919e_8d09_ef11c6679e0d -->|method| 6db50b9d_1b80_9b58_97b2_d49cee054cf2

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributorDependencyTreeTest.java lines 32–980

public class WeightedFairQueueByteDistributorDependencyTreeTest extends
                                                AbstractWeightedFairQueueByteDistributorDependencyTest {
    private static final int leadersId = 3; // js, css
    private static final int unblockedId = 5;
    private static final int backgroundId = 7;
    private static final int speculativeId = 9;
    private static final int followersId = 11; // images
    private static final short leadersWeight = 201;
    private static final short unblockedWeight = 101;
    private static final short backgroundWeight = 1;
    private static final short speculativeWeight = 1;
    private static final short followersWeight = 1;

    @BeforeEach
    public void setup() throws Http2Exception {
        MockitoAnnotations.initMocks(this);

        setup(0);
    }

    private void setup(int maxStateOnlySize) {
        connection = new DefaultHttp2Connection(false);
        distributor = new WeightedFairQueueByteDistributor(connection, maxStateOnlySize);

        // Assume we always write all the allocated bytes.
        doAnswer(writeAnswer(false)).when(writer).write(any(Http2Stream.class), anyInt());
    }

    @Test
    public void closingStreamWithChildrenDoesNotCauseConcurrentModification() throws Http2Exception {
        // We create enough streams to wrap around the child array. We carefully craft the stream ids so that they hash
        // codes overlap with respect to the child collection. If the implementation is not careful this may lead to a
        // concurrent modification exception while promoting all children to the connection stream.
        final Http2Stream streamA = connection.local().createStream(1, false);
        final int numStreams = INITIAL_CHILDREN_MAP_SIZE - 1;
        for (int i = 0, streamId = 3; i < numStreams; ++i, streamId += INITIAL_CHILDREN_MAP_SIZE) {
            final Http2Stream stream = connection.local().createStream(streamId, false);
            setPriority(stream.id(), streamA.id(), DEFAULT_PRIORITY_WEIGHT, false);
        }
        assertEquals(INITIAL_CHILDREN_MAP_SIZE, connection.numActiveStreams());
        streamA.close();
        assertEquals(numStreams, connection.numActiveStreams());
    }

    @Test
    public void closeWhileIteratingDoesNotNPE() throws Http2Exception {
        final Http2Stream streamA = connection.local().createStream(3, false);
        final Http2Stream streamB = connection.local().createStream(5, false);
        final Http2Stream streamC = connection.local().createStream(7, false);
        setPriority(streamB.id(), streamA.id(), DEFAULT_PRIORITY_WEIGHT, false);
        connection.forEachActiveStream(new Http2StreamVisitor() {
            @Override
            public boolean visit(Http2Stream stream) throws Http2Exception {
                streamA.close();
                setPriority(streamB.id(), streamC.id(), DEFAULT_PRIORITY_WEIGHT, false);
                return true;
            }
        });
    }

    @Test
    public void localStreamCanDependUponIdleStream() throws Http2Exception {
        setup(1);

        Http2Stream streamA = connection.local().createStream(1, false);
        setPriority(3, streamA.id(), MIN_WEIGHT, true);
        assertTrue(distributor.isChild(3, streamA.id(), MIN_WEIGHT));
    }

    @Test
    public void remoteStreamCanDependUponIdleStream() throws Http2Exception {
        setup(1);

        Http2Stream streamA = connection.remote().createStream(2, false);
        setPriority(4, streamA.id(), MIN_WEIGHT, true);
        assertTrue(distributor.isChild(4, streamA.id(), MIN_WEIGHT));
    }

    @Test
    public void prioritizeShouldUseDefaults() throws Exception {
        Http2Stream stream = connection.local().createStream(1, false);

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free