This method processes the values associated with the start or end of a scoped
activity.

@param trace The trace
@param node The node
@param direction The direction
@param headers The optional headers
@param values The values
340731
protected void processValues(Trace trace, Node node, Direction direction,
            Map<String, ?> headers, Object[] values) {

        if (node.interactionNode()) {
            Message m = null;

            if (direction == Direction.In) {
                m = ((InteractionNode) node).getIn();
                if (m == null) {
                    m = new Message();
                    ((InteractionNode) node).setIn(m);
                }
            } else {
                m = ((InteractionNode) node).getOut();
                if (m == null) {
                    m = new Message();
                    ((InteractionNode) node).setOut(m);
                }
            }

            if (headers != null && m.getHeaders().isEmpty()) {
                // TODO: Need to have config to determine whether headers should be logged
                for (Map.Entry<String, ?> stringEntry : headers.entrySet()) {
                    String value = getHeaderValueText(stringEntry.getValue());

                    if (value != null) {
                        m.getHeaders().put(stringEntry.getKey(), value);
                    }
                }
            }
        }

        if (processorManager != null) {
            processorManager.process(trace, node, direction, headers, values);
        }
    }
499429
public void trace( String format, Object arg )
    {
        if( m_delegate.isTraceEnabled() )
        {
            FormattingTuple tuple = MessageFormatter.format( format, arg );
            m_delegate.trace( tuple.getMessage(), tuple.getThrowable() );
        }
    }
315089
public void seekBySpan(String direction, String seekAmount, String span) {
    if(span.startsWith(SEEK_PREFIX)) span = span.substring(3);
    int seekAmountInt = Integer.parseInt(seekAmount);
    assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
    assert(span.equals(DAY) || span.equals(WEEK) || span.equals(MONTH) || 
        span.equals(YEAR) || span.equals(HOUR) || span.equals(MINUTE) || 
        span.equals(SECOND));
    
    boolean isDateSeek = span.equals(DAY) || span.equals(WEEK) || 
      span.equals(MONTH) || span.equals(YEAR);

    if(isDateSeek) {
      markDateInvocation();
    }
    else {
      markTimeInvocation(null);
    }
    
    int sign = direction.equals(DIR_RIGHT) ? 1 : -1;
    int field = 
      span.equals(DAY) ? Calendar.DAY_OF_YEAR : 
      span.equals(WEEK) ? Calendar.WEEK_OF_YEAR :
      span.equals(MONTH) ? Calendar.MONTH :
      span.equals(YEAR) ? Calendar.YEAR : 
      span.equals(HOUR) ? Calendar.HOUR: 
      span.equals(MINUTE) ? Calendar.MINUTE: 
      span.equals(SECOND) ? Calendar.SECOND:
      null;
    if(field > 0) _calendar.add(field, seekAmountInt * sign);
  }
291558
public static void log(String message, String... values) {
        log(LogLevel.INFO, message, values);
    }
388427
public void processingInstruction(String arg0, String arg1)
        throws SAXException
    {
        if (m_tracer != null)
            super.fireEscapingEvent(arg0, arg1);
    }
410305
@Override
    public void trace(String format, Object arg) {
        if (logger.isTraceEnabled()) {
            FormattingTuple ft = MessageFormatter.format(format, arg);
            logger.trace(ft.getMessage(), ft.getThrowable());
        }
    }
833589
@Override
    public void setFetchDirection(int direction) throws SQLException {
        if ((direction != FETCH_FORWARD) && (direction != FETCH_REVERSE)
                && (direction != FETCH_UNKNOWN))
            throw SQLError.get(SQLError.ILLEGAL_STATEMENT, direction);
        this.fetchDirection = direction;
    }
869482
public void setTraces(Trace... traces) {
        this.traces.clear();
        for (Trace trace : traces) {
            if (!trace.addReplacements(this.traces)) {
                this.traces.add(trace);
            }
        }
    }
891969
final void setRRP(List<SIDestinationAddress> value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setRRP", value);

        if (value == null) {
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATH_DESTINATIONNAME, null);
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATH_MEID, null);
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATHLOCALONLY, null);
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATH_BUSNAME, null);
        } else {
            // The List provided should either be one of our RoutingPathList objects or
            // a standard Java List containing (non-null) SIDestinationAddress elements.
            // If it's the latter we just create a RoutingPathList to wrap it.
            RoutingPathList rp;
            if (value instanceof RoutingPathList)
                rp = (RoutingPathList) value;
            else
                rp = new RoutingPathList(value);

            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATH_DESTINATIONNAME, rp.getNames());
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATH_MEID, rp.getMEs());
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATHLOCALONLY, rp.getLocalOnlys());
            getHdr2().setField(JsHdr2Access.REVERSEROUTINGPATH_BUSNAME, rp.getBusNames());
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setRRP");
    }
1296031
public static void trace(String path, String acceptType, Route route) {
        getInstance().trace(path, acceptType, route);
    }
118764
@Override
    public Object onRequest(Object request, Map<String,String> headers) {
        if (headers.containsKey(Listener.METAINFO_HTTP_METHOD)) {
            Tracing tracing = TraceHelper.getTracing("mdw-service");
            HttpTracing httpTracing = HttpTracing.create(tracing);
            handler = HttpServerHandler.create(httpTracing, new ServerAdapter());
            extractor = httpTracing.tracing().propagation().extractor(ServerAdapter.ServerRequest::getHeader);
            span = handler.handleReceive(extractor, new ServerAdapter.ServerRequest(headers));
            scope = httpTracing.tracing().tracer().withSpanInScope(span);
        }
        return null;
    }
1136725
@Override
  protected void visitForNode(ForNode node) {
    boolean hasIfempty = (node.numChildren() == 2);
    // NOTE: below we call id(varName) on a number of variables instead of using
    // VariableDeclaration.ref(),  this is because the refs() might be referenced on the other side
    // of a call to visitChildrenReturningCodeChunk.
    // That will break the normal behavior of FormattingContext being able to tell whether or not an
    // initial statement has already been generated because it eagerly coerces the value to a
    // string.  This will lead to redundant variable declarations.
    // When visitChildrenReturningCodeChunk is gone, this can be cleaned up, but for now we have to
    // manually decide where to declare the variables.
    List<Statement> statements = new ArrayList<>();
    // Build some local variable names.
    ForNonemptyNode nonEmptyNode = (ForNonemptyNode) node.getChild(0);
    String varPrefix = nonEmptyNode.getVarName() + node.getId();

    // TODO(b/32224284): A more consistent pattern for local variable management.
    String limitName = varPrefix + "ListLen";
    Expression limitInitializer;
    Optional<RangeArgs> args = RangeArgs.createFromNode(node);
    Function<Expression, Expression> getDataItemFunction;
    if (args.isPresent()) {
      RangeArgs range = args.get();
      // if any of the expressions are too expensive, allocate local variables for them
      final Expression start =
          maybeStashInLocal(
              range.start().isPresent() ? translateExpr(range.start().get()) : Expression.number(0),
              varPrefix + "_RangeStart",
              statements);
      final Expression end =
          maybeStashInLocal(translateExpr(range.limit()), varPrefix + "_RangeEnd", statements);
      final Expression step =
          maybeStashInLocal(
              range.increment().isPresent()
                  ? translateExpr(range.increment().get())
                  : Expression.number(1),
              varPrefix + "_RangeStep",
              statements);
      // the logic we want is
      // step * (end-start) < 0 ? 0 : ( (end-start)/step + ((end-start) % step == 0 ? 0 : 1));
      // but given that all javascript numbers are doubles we can simplify this somewhat.
      // Math.max(0, Match.ceil((end - start)/step))
      // should yield identical results.
      limitInitializer =
          dottedIdNoRequire("Math.max")
              .call(
                  number(0), dottedIdNoRequire("Math.ceil").call(end.minus(start).divideBy(step)));
      // optimize for foreach over a range
      getDataItemFunction = index -> start.plus(index.times(step));
    } else {
      // Define list var and list-len var.
      Expression dataRef = translateExpr(node.getExpr());
      final String listVarName = varPrefix + "List";
      Expression listVar = VariableDeclaration.builder(listVarName).setRhs(dataRef).build().ref();
      // does it make sense to store this in a variable?
      limitInitializer = listVar.dotAccess("length");
      getDataItemFunction = index -> id(listVarName).bracketAccess(index);
    }

    // Generate the foreach body as a CodeChunk.
    Expression limit = id(limitName);
    statements.add(VariableDeclaration.builder(limitName).setRhs(limitInitializer).build());
    Statement foreachBody = handleForeachLoop(nonEmptyNode, limit, getDataItemFunction);

    if (hasIfempty) {
      // If there is an ifempty node, wrap the foreach body in an if statement and append the
      // ifempty body as the else clause.
      Statement ifemptyBody = visitChildrenReturningCodeChunk(node.getChild(1));
      Expression limitCheck = limit.op(Operator.GREATER_THAN, number(0));

      foreachBody = ifStatement(limitCheck, foreachBody).setElse(ifemptyBody).build();
    }
    statements.add(foreachBody);
    jsCodeBuilder.append(Statement.of(statements));
  }
490268
public void setTraceSummaries(java.util.Collection<TraceSummary> traceSummaries) {
        if (traceSummaries == null) {
            this.traceSummaries = null;
            return;
        }

        this.traceSummaries = new java.util.ArrayList<TraceSummary>(traceSummaries);
    }
1003224
public static void log(final String templateName, final Template template, final Values values) {
        new ValuesLogger().doLog(templateName, template, values);
    }
1243944
public static void setPreferredAttributeValuesForTrafficDirection(TrafficDirection direction, List<String> values) {
		int i = 0;
		for (final String value : values) {
			setPreferredAttributeValueForTrafficDirection(direction, i, value);
			++i;
		}
		setPreferredAttributeValueForTrafficDirection(direction, i, null);
	}
994475
@Override
    public void setTraceRouter(WsTraceRouter traceRouter) {

        internalTraceRouter.set(traceRouter);

        // Pass the earlierMessages queue to the router.
        // Now that the internalMessageRouter is non-null, this class will
        // NOT add any more messages to the earlierMessages queue.
        // The MessageRouter basically owns the earlierMessages queue
        // from now on.
        if (earlierTraces != null) {
            synchronized (this) {
                if (earlierTraces != null) {
                    traceRouter.setEarlierTraces(earlierTraces);
                }
            }
        } else {
            traceRouter.setEarlierTraces(null);
        }
    }
1053859
public void serverCallStarted(ServerCallInfo<?, ?> callInfo) {
    for (StreamTracer tracer : tracers) {
      ((ServerStreamTracer) tracer).serverCallStarted(callInfo);
    }
  }