public static void processAllExitProbeExtensions ( Event event , RequestContext requestContext ) { List < ProbeExtension > probeExtnList = RequestProbeService . getProbeExtensions ( ) ; for ( int i = 0 ; i < probeExtnList . size ( ) ; i ++ ) { ProbeExtension probeExtension = probeExtnList . get ( i ) ; try { // Exit enabled?? if ( probeExtension . invokeForEventExit ( ) ) { // To be sampled ?? if ( requestContext . getRequestId ( ) . getSequenceNumber ( ) % probeExtension . getRequestSampleRate ( ) == 0 ) { if ( event == requestContext . getRootEvent ( ) && probeExtension . invokeForRootEventsOnly ( ) == true && ( probeExtension . invokeForEventTypes ( ) == null || probeExtension . invokeForEventTypes ( ) . contains ( event . getType ( ) ) ) ) { probeExtension . processExitEvent ( event , requestContext ) ; } if ( probeExtension . invokeForRootEventsOnly ( ) == false && ( probeExtension . invokeForEventTypes ( ) == null || probeExtension . invokeForEventTypes ( ) . contains ( event . getType ( ) ) ) ) { probeExtension . processExitEvent ( event , requestContext ) ; } } } } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "----------------Probe extension invocation failure---------------" ) ; Tr . debug ( tc , probeExtension . getClass ( ) . getName ( ) + ".processExitEvent failed because of the following reason:" ) ; Tr . debug ( tc , e . getMessage ( ) ) ; } FFDCFilter . processException ( e , RequestProbeService . class . getName ( ) + ".processAllExitProbeExtensions" , "185" ) ; } } if ( event == requestContext . getRootEvent ( ) ) { // Remove the request from active request list try { RequestContext storedRequestContext = activeRequests . get ( requestContext . getRequestContextIndex ( ) ) ; // 1) Check to handle stale requests. // A long running stale request from the last time the feature was enabled could potentially // end up evicting a valid request that is occupying the same slot in the list. // 2) Also check if the returned request context is null, this can happen when we remove the feature while // a request is executing as we clean up the active requests list and the slot no longer holds a request context. if ( storedRequestContext != null && ( storedRequestContext . getRequestId ( ) == requestContext . getRequestId ( ) ) ) activeRequests . remove ( requestContext . getRequestContextIndex ( ) ) ; } catch ( ArrayIndexOutOfBoundsException e ) { //Do nothing as this can fail for an in-flight request when the feature is disabled //Rational being, the active request list gets reset and this index can no longer be valid. } } }
Iterate through all the probe extensions and process all the exit method of the available probe extension