public synchronized H2WriteQEntry findNextWriteEntry() {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "findNextWriteEntry entry: from root " + root);
        }

        Node node = root.findNextWrite();
        if (node != null) {
            H2WriteQEntry e = node.getEntry();
            return e;
        }

        return null;
    }
public synchronized H2WriteQEntry findNextWriteEntry ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "findNextWriteEntry entry: from root " + root ) ; } Node node = root . findNextWrite ( ) ; if ( node != null ) { H2WriteQEntry e = node . getEntry ( ) ; return e ; } return null ; }
Algorithm according to the spec:
Next write is the top weighted node at the next level given all priorities and current number of writes compared to the others.
If that node is not wanting to write, then before moving to the next top weighted sibling node, try the children under the currently selected node.
This is a recurive algorithm. So, once a node is selected, one of it children/grandchildren, etc... will write, unless none of them want to,
before moving on to a sibling node.

@return node to perform the next write, or null if no nodes want to write.