You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2020/02/28 10:35:17 UTC
[tomcat] branch master updated: Reconstruct getStartTime since it
is not used
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 4645d49 Reconstruct getStartTime since it is not used
4645d49 is described below
commit 4645d492999ef30393222a4c2c1efef4ddd293ca
Author: remm <re...@apache.org>
AuthorDate: Fri Feb 28 11:34:59 2020 +0100
Reconstruct getStartTime since it is not used
Deprecate setStartTime, will be removed. getStartTime could be a good
utility method, so will probably leave it there.
---
java/org/apache/coyote/Request.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/coyote/Request.java b/java/org/apache/coyote/Request.java
index 3c095cb..5e6e470 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -21,6 +21,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import jakarta.servlet.ReadListener;
@@ -153,7 +154,6 @@ public final class Request {
private long bytesRead=0;
// Time of the request - useful to avoid repeated calls to System.currentTime
- private long startTime = -1;
private long startTimeNanos = -1;
private int available = 0;
@@ -565,11 +565,16 @@ public final class Request {
}
public long getStartTime() {
- return startTime;
+ return System.currentTimeMillis() - TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTimeNanos);
}
+ /**
+ *
+ * @param startTime
+ * @deprecated This setter will be removed in Tomcat 10.
+ */
+ @Deprecated
public void setStartTime(long startTime) {
- this.startTime = startTime;
}
public long getStartTimeNanos() {
@@ -655,7 +660,6 @@ public final class Request {
listener = null;
allDataReadEventSent.set(false);
- startTime = -1;
startTimeNanos = -1;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org