updateDependencyTree() — netty Function Reference
Architecture documentation for the updateDependencyTree() function in WeightedFairQueueByteDistributor.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ebb4ce48_a19b_1763_6677_772bd73eafff["updateDependencyTree()"] f6394c11_feeb_5e3e_8717_b7d2d36bbf34["WeightedFairQueueByteDistributor"] ebb4ce48_a19b_1763_6677_772bd73eafff -->|defined in| f6394c11_feeb_5e3e_8717_b7d2d36bbf34 fb17eda3_f88a_c99f_e79c_e7e5ccb06a40["takeChild()"] ebb4ce48_a19b_1763_6677_772bd73eafff -->|calls| fb17eda3_f88a_c99f_e79c_e7e5ccb06a40 25f3d9c7_29c4_05d1_8c21_d15e89a37789["notifyParentChanged()"] ebb4ce48_a19b_1763_6677_772bd73eafff -->|calls| 25f3d9c7_29c4_05d1_8c21_d15e89a37789 e7564f5e_a83e_9a00_89a6_e897079b3574["isDescendantOf()"] ebb4ce48_a19b_1763_6677_772bd73eafff -->|calls| e7564f5e_a83e_9a00_89a6_e897079b3574 a7426564_13ec_4caa_ec35_83d94c9ad9d0["removeChild()"] ebb4ce48_a19b_1763_6677_772bd73eafff -->|calls| a7426564_13ec_4caa_ec35_83d94c9ad9d0 fa3ca25f_05dd_7371_b6a8_9b6d9a3f7cb3["State()"] ebb4ce48_a19b_1763_6677_772bd73eafff -->|calls| fa3ca25f_05dd_7371_b6a8_9b6d9a3f7cb3 style ebb4ce48_a19b_1763_6677_772bd73eafff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java lines 195–254
@Override
public void updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive) {
State state = state(childStreamId);
if (state == null) {
// If there is no State object that means there is no Http2Stream object and we would have to keep the
// State object in the stateOnlyMap and stateOnlyRemovalQueue. However if maxStateOnlySize is 0 this means
// stateOnlyMap and stateOnlyRemovalQueue are empty collections and cannot be modified so we drop the State.
if (maxStateOnlySize == 0) {
return;
}
state = new State(childStreamId);
stateOnlyRemovalQueue.add(state);
stateOnlyMap.put(childStreamId, state);
}
State newParent = state(parentStreamId);
if (newParent == null) {
// If there is no State object that means there is no Http2Stream object and we would have to keep the
// State object in the stateOnlyMap and stateOnlyRemovalQueue. However if maxStateOnlySize is 0 this means
// stateOnlyMap and stateOnlyRemovalQueue are empty collections and cannot be modified so we drop the State.
if (maxStateOnlySize == 0) {
return;
}
newParent = new State(parentStreamId);
stateOnlyRemovalQueue.add(newParent);
stateOnlyMap.put(parentStreamId, newParent);
// Only the stream which was just added will change parents. So we only need an array of size 1.
List<ParentChangedEvent> events = new ArrayList<ParentChangedEvent>(1);
connectionState.takeChild(newParent, false, events);
notifyParentChanged(events);
}
// if activeCountForTree == 0 then it will not be in its parent's pseudoTimeQueue and thus should not be counted
// toward parent.totalQueuedWeights.
if (state.activeCountForTree != 0 && state.parent != null) {
state.parent.totalQueuedWeights += weight - state.weight;
}
state.weight = weight;
if (newParent != state.parent || exclusive && newParent.children.size() != 1) {
final List<ParentChangedEvent> events;
if (newParent.isDescendantOf(state)) {
events = new ArrayList<ParentChangedEvent>(2 + (exclusive ? newParent.children.size() : 0));
state.parent.takeChild(newParent, false, events);
} else {
events = new ArrayList<ParentChangedEvent>(1 + (exclusive ? newParent.children.size() : 0));
}
newParent.takeChild(state, exclusive, events);
notifyParentChanged(events);
}
// The location in the dependency tree impacts the priority in the stateOnlyRemovalQueue map. If we created new
// State objects we must check if we exceeded the limit after we insert into the dependency tree to ensure the
// stateOnlyRemovalQueue has been updated.
while (stateOnlyRemovalQueue.size() > maxStateOnlySize) {
State stateToRemove = stateOnlyRemovalQueue.poll();
stateToRemove.parent.removeChild(stateToRemove);
stateOnlyMap.remove(stateToRemove.streamId);
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does updateDependencyTree() do?
updateDependencyTree() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java.
Where is updateDependencyTree() defined?
updateDependencyTree() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java at line 195.
What does updateDependencyTree() call?
updateDependencyTree() calls 5 function(s): State, isDescendantOf, notifyParentChanged, removeChild, takeChild.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free