Commit cb7f99ad authored by Andy Wilkinson's avatar Andy Wilkinson

Polish "Measure with nanoseconds in HttpExchangeTracer"

See gh-22266
parent d72f5139
......@@ -103,7 +103,7 @@ public class HttpExchangeTracer {
}
private long calculateTimeTaken(HttpTrace trace) {
return TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - trace.getNanoTime());
return TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - trace.getStartNanoTime());
}
private final class FilteredTraceableRequest implements TraceableRequest {
......
......@@ -46,7 +46,7 @@ public final class HttpTrace {
private volatile Long timeTaken;
private final transient long nanoTime;
private final long startNanoTime;
/**
* Creates a fully-configured {@code HttpTrace} instance. Primarily for use by
......@@ -69,13 +69,13 @@ public final class HttpTrace {
this.principal = principal;
this.session = session;
this.timeTaken = timeTaken;
this.nanoTime = 0;
this.startNanoTime = 0;
}
HttpTrace(TraceableRequest request) {
this.request = new Request(request);
this.timestamp = Instant.now();
this.nanoTime = System.nanoTime();
this.startNanoTime = System.nanoTime();
}
public Instant getTimestamp() {
......@@ -122,8 +122,8 @@ public final class HttpTrace {
this.timeTaken = timeTaken;
}
long getNanoTime() {
return this.nanoTime;
long getStartNanoTime() {
return this.startNanoTime;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment