code: private int distributeToChildren(int maxBytes, Writer writer, State state) throws Http2Exception {
          long oldTotalQueuedWeights = state.totalQueuedWeights;
          State childState = state.pollPseudoTimeQueue();
          State nextChildState = state.peekPseudoTimeQueue();
          childState.setDistributing();
          try {
              assert nextChildState == null || nextChildState.pseudoTimeToWrite >= childState.pseudoTimeToWrite :
                  "nextChildState[" + nextChildState.streamId + "].pseudoTime(" + nextChildState.pseudoTimeToWrite +
                  ") < " + " childState[" + childState.streamId + "].pseudoTime(" + childState.pseudoTimeToWrite + ")";
              int nsent = distribute(nextChildState == null ? maxBytes :
                              min(maxBytes, (int) min((nextChildState.pseudoTimeToWrite - childState.pseudoTimeToWrite) *
                                                 childState.weight / oldTotalQueuedWeights + allocationQuantum, MAX_VALUE)
                                 ),
                                 writer,
                                 childState);
              state.pseudoTime += nsent;
              childState.updatePseudoTime(state, nsent, oldTotalQueuedWeights);
              return nsent;
          } finally {
              childState.unsetDistributing();
              // Do in finally to ensure the internal flags is not corrupted if an exception is thrown.
              // The offer operation is delayed until we unroll up the recursive stack, so we don't have to remove from
              // the priority pseudoTimeQueue due to a write operation.
              if (childState.activeCountForTree != 0) {
                  state.offerPseudoTimeQueue(childState);
              }
          }
      }
docs: It is a pre-condition that {@code state.poll()} returns a non-{@code null} value. This is a result of the way
  the allocation algorithm is structured and can be explained in the following cases:
  <h3>For the recursive case</h3>
  If a stream has no children (in the allocation tree) than that node must be active or it will not be in the
  allocation tree. If a node is active then it will not delegate to children and recursion ends.
  <h3>For the initial case</h3>
  We check connectionState.activeCountForTree == 0 before any allocation is done. So if the connection stream
  has no active children we don't get into this method.