public Object execute ( BlueprintCallExecutor executor , Object ... parameters ) throws Exception { stats . addRequest ( ) ; long startTime = System . nanoTime ( ) ; TracedCall aTracedCall = RunningTraceContainer . getCurrentlyTracedCall ( ) ; TraceStep currentElement = null ; CurrentlyTracedCall currentlyTracedCall = aTracedCall . callTraced ( ) ? ( CurrentlyTracedCall ) aTracedCall : null ; if ( currentlyTracedCall != null ) currentElement = currentlyTracedCall . startStep ( new StringBuilder ( getProducerId ( ) ) . append ( ' ' ) . append ( "execute" ) . toString ( ) , this , "execute" ) ; try { return executor . execute ( parameters ) ; } catch ( Exception e ) { stats . notifyError ( e ) ; throw e ; } finally { long duration = System . nanoTime ( ) - startTime ; stats . addExecutionTime ( duration ) ; stats . notifyRequestFinished ( ) ; if ( currentElement != null ) currentElement . setDuration ( duration ) ; if ( currentlyTracedCall != null ) currentlyTracedCall . endStep ( ) ; } }
Called by the surrounding code whenever the action which we are measuring is actually executed .