protected static void initialiseSourceInfo(List<SourceInfo> sourceInfoList, String tenantId,
            Trace trace, StringBuffer parentNodeId, int pos, Node node) {

        SourceInfo si = new SourceInfo();

        parentNodeId.append(':');
        parentNodeId.append(pos);

        si.setId(parentNodeId.toString());

        si.setTimestamp(node.getTimestamp());
        si.setDuration(node.getDuration());
        si.setTraceId(trace.getTraceId());
        si.setFragmentId(trace.getFragmentId());
        si.setHostName(trace.getHostName());
        si.setHostAddress(trace.getHostAddress());
        si.setMultipleConsumers(true);              // Multiple links could reference same node
        si.setProperties(node.getProperties());     // Just reference, to avoid unnecessary copying

        // TODO: HWKBTM-348: Should be configurable based on the wait interval plus
        // some margin of error - primarily for cases where a job scheduler
        // is used. If direct communications, then only need to cater for
        // latency.

        if (log.isLoggable(Level.FINEST)) {
            log.finest("Adding source information for node id=" + si.getId() + " si=" + si);
        }
        sourceInfoList.add(si);

        // If node is a Producer, then check if other correlation ids are available
        if (node.getClass() == Producer.class) {
            List<CorrelationIdentifier> cids = node.findCorrelationIds(Scope.Interaction, Scope.ControlFlow);
            if (!cids.isEmpty()) {
                for (int i = 0; i < cids.size(); i++) {
                    CorrelationIdentifier cid = cids.get(i);
                    SourceInfo copy = new SourceInfo(si);
                    copy.setId(cid.getValue());
                    copy.setMultipleConsumers(((Producer)node).multipleConsumers());

                    if (log.isLoggable(Level.FINEST)) {
                        log.finest("Extra source information for scope=" + cid.getScope()
                            + " id=" + copy.getId() + " si=" + copy);
                    }
                    sourceInfoList.add(copy);
                }
            }
        }

        if (node instanceof ContainerNode) {
            int nodeIdLen = parentNodeId.length();

            for (int j = 0; j < ((ContainerNode) node).getNodes().size(); j++) {
                initialiseSourceInfo(sourceInfoList, tenantId, trace, parentNodeId, j,
                        ((ContainerNode) node).getNodes().get(j));

                // Restore parent node id
                parentNodeId.delete(nodeIdLen, parentNodeId.length());
            }
        }
    }
protected static void initialiseSourceInfo ( List < SourceInfo > sourceInfoList , String tenantId , Trace trace , StringBuffer parentNodeId , int pos , Node node ) { SourceInfo si = new SourceInfo ( ) ; parentNodeId . append ( ':' ) ; parentNodeId . append ( pos ) ; si . setId ( parentNodeId . toString ( ) ) ; si . setTimestamp ( node . getTimestamp ( ) ) ; si . setDuration ( node . getDuration ( ) ) ; si . setTraceId ( trace . getTraceId ( ) ) ; si . setFragmentId ( trace . getFragmentId ( ) ) ; si . setHostName ( trace . getHostName ( ) ) ; si . setHostAddress ( trace . getHostAddress ( ) ) ; si . setMultipleConsumers ( true ) ; si . setProperties ( node . getProperties ( ) ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Adding source information for node id=" + si . getId ( ) + " si=" + si ) ; } sourceInfoList . add ( si ) ; if ( node . getClass ( ) == Producer . class ) { List < CorrelationIdentifier > cids = node . findCorrelationIds ( Scope . Interaction , Scope . ControlFlow ) ; if ( ! cids . isEmpty ( ) ) { for ( int i = 0 ; i < cids . size ( ) ; i ++ ) { CorrelationIdentifier cid = cids . get ( i ) ; SourceInfo copy = new SourceInfo ( si ) ; copy . setId ( cid . getValue ( ) ) ; copy . setMultipleConsumers ( ( ( Producer ) node ) . multipleConsumers ( ) ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Extra source information for scope=" + cid . getScope ( ) + " id=" + copy . getId ( ) + " si=" + copy ) ; } sourceInfoList . add ( copy ) ; } } } if ( node instanceof ContainerNode ) { int nodeIdLen = parentNodeId . length ( ) ; for ( int j = 0 ; j < ( ( ContainerNode ) node ) . getNodes ( ) . size ( ) ; j ++ ) { initialiseSourceInfo ( sourceInfoList , tenantId , trace , parentNodeId , j , ( ( ContainerNode ) node ) . getNodes ( ) . get ( j ) ) ; parentNodeId . delete ( nodeIdLen , parentNodeId . length ( ) ) ; } } }
This method initialises an individual node within a trace.

@param sourceInfoList The source info list
@param tenantId The tenant id
@param trace The trace
@param parentNodeId The parent node id
@param node The node