protected void checkForCompletion ( FragmentBuilder builder , Node node ) { // Check if completed if ( builder . isComplete ( ) ) { if ( node != null ) { Trace trace = builder . getTrace ( ) ; if ( builder . getLevel ( ) . ordinal ( ) <= ReportingLevel . None . ordinal ( ) ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Not recording trace (level=" + builder . getLevel ( ) + "): " + trace ) ; } } else { if ( trace != null && ! trace . getNodes ( ) . isEmpty ( ) ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Record trace: " + trace ) ; } // Check if first top level node is an internal consumer // and if so move subsequent top level nodes within its scope if ( trace . getNodes ( ) . size ( ) > 1 && trace . getNodes ( ) . get ( 0 ) . getClass ( ) == Consumer . class && ( ( Consumer ) trace . getNodes ( ) . get ( 0 ) ) . getEndpointType ( ) == null ) { Consumer consumer = ( Consumer ) trace . getNodes ( ) . get ( 0 ) ; while ( trace . getNodes ( ) . size ( ) > 1 ) { consumer . getNodes ( ) . add ( trace . getNodes ( ) . get ( 1 ) ) ; trace . getNodes ( ) . remove ( 1 ) ; } } recorder . record ( trace ) ; } } } fragmentManager . clear ( ) ; // Remove uncompleted correlation ids for ( String id : builder . getUncompletedCorrelationIds ( ) ) { correlations . remove ( id ) ; } diagnostics ( ) ; } }
This method checks whether the supplied fragment has been completed and therefore should be processed .