private void notifyMerge() {
        if (pending.decrementAndGet() != 0) {
            return; // not done yet
        }

        // Merges the trace information from all children into this. This method takes care not to spend cycles
        // manipulating the trace in case tracing is disabled.
        if (trace.getLevel() > 0) {
            TraceNode tail = new TraceNode();
            for (RoutingNode child : children) {
                TraceNode root = child.trace.getRoot();
                tail.addChild(root);
                root.clear();
            }
            tail.setStrict(false);
            trace.getRoot().addChild(tail);
        }

        // Execute the {@link RoutingPolicy#notifyMerge(RoutingContext)} method of the current routing policy. If a
        // policy fails to produce a reply, this attaches an error reply to this node.
        PolicyDirective dir = routingContext.getDirective();
        if (trace.shouldTrace(TraceLevel.SPLIT_MERGE)) {
            trace.trace(TraceLevel.SPLIT_MERGE, "Routing policy '" + dir.getName() + "' merging replies.");
        }
        try {
            policy.merge(routingContext);
        } catch (RuntimeException e) {
            setError(ErrorCode.POLICY_ERROR,
                     "Policy '" + dir.getName() + "' and route '" + route + "' threw an exception during merge; " + exceptionMessageWithTrace(e));
        }
        if (reply == null) {
            setError(ErrorCode.APP_FATAL_ERROR,
                     "Routing policy '" + routingContext.getDirective().getName() + "' failed to merge replies.");
        }

        // Notifies the parent node.
        notifyParent();
    }
This method merges the content of all its children, and invokes itself on the parent node. If not all children
are ready for merge, this method does nothing. The rationale for this is that the last child to receive a reply
will propagate the merge upwards. Once this method reaches the root node, the reply is either scheduled for
resending or passed to the owning reply handler.
messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingNode.java