public void trackRequest ( String requestDescriptor , long requestId ) { Preconditions . checkNotNull ( requestDescriptor , "Attempting to track a null request descriptor." ) ; if ( ! tracingEnabled ) { return ; } synchronized ( lock ) { List < Long > requestIds = ongoingRequests . getIfPresent ( requestDescriptor ) ; if ( requestIds == null ) { requestIds = Collections . synchronizedList ( new ArrayList <> ( ) ) ; } requestIds . add ( requestId ) ; ongoingRequests . put ( requestDescriptor , requestIds ) ; } log . debug ( "Tracking request {} with id {}." , requestDescriptor , requestId ) ; }
Adds a request descriptor and request id pair in the cache if tracing is enabled . In the case of tracking a request with an existing descriptor this method adds the request id to the list associated to the descriptor .