* @param req the incoming request
* @param resp the outgoing response
* @param stop a stopwatch which has measured the request / response handling time
*/
final void notifyRequest(RestxRequest req, RestxResponse resp, Stopwatch stop) {
RequestStats requestStats = stats.getRequestStats().get(req.getHttpMethod());
if (requestStats != null) {
requestStats.getRequestsCount().incrementAndGet();
long duration = stop.elapsed(TimeUnit.MICROSECONDS);
requestStats.getTotalDuration().addAndGet(duration);
long minDuration;
while ((minDuration = requestStats.getMinDuration().get()) > duration) {
if (requestStats.getMinDuration().compareAndSet(minDuration, duration)) {
break;
}
}
long maxDuration;
while ((maxDuration = requestStats.getMaxDuration().get()) < duration) {
if (requestStats.getMaxDuration().compareAndSet(maxDuration, duration)) {
break;
}
}
}
touch();