Skip to content

Commit

Permalink
[SCB-2052] fix get connection time is 0 when get connection timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
wujimin committed Jul 30, 2020
1 parent 531e121 commit b37fd8a
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.servicecomb.foundation.vertx.metrics.metric;

// if can not get connection from connection pool
// then both requestBeginTime and requestEndTime will be 0
public class DefaultHttpSocketMetric extends DefaultTcpSocketMetric {
private long requestBeginTime;

Expand All @@ -29,15 +31,15 @@ public DefaultHttpSocketMetric(DefaultEndpointMetric endpointMetric) {
}

public long getRequestBeginTime() {
return requestBeginTime;
return requestBeginTime != 0 ? requestBeginTime : System.nanoTime();
}

public void requestBegin() {
this.requestBeginTime = System.nanoTime();
}

public long getRequestEndTime() {
return requestEndTime;
return requestEndTime != 0 ? requestEndTime : System.nanoTime();
}

public void requestEnd() {
Expand Down

0 comments on commit b37fd8a

Please sign in to comment.