presto-main/src/main/java/io/prestosql/execution/resourcegroups/StochasticPriorityQueue.java/StochasticPriorityQueue/addOrUpdate
class StochasticPriorityQueue:    @Override
    public boolean addOrUpdate(E element, long priority)
    {
        checkArgument(priority > 0, "priority must be positive");
        if (root == null) {
            root = new Node<>(Optional.empty(), element);
            root.setTickets(priority);
            index.put(element, root);
            return true;
        }
        Node<E> node = index.get(element);
        if (node != null) {
            node.setTickets(priority);
            return false;
        }

        node = root.addNode(element, priority);
        index.put(element, node);
        return true;
    }