diff options
Diffstat (limited to 'vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java')
-rw-r--r-- | vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java index 1ef52ac05bb..c5864e48681 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java @@ -30,6 +30,8 @@ import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; +import java.time.Clock; +import java.time.Instant; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -62,6 +64,7 @@ class ApacheGatewayConnection implements GatewayConnection { private final String clusterSpecificRoute; private final ConnectionParams connectionParams; private HttpClient httpClient; + private Instant connectionTime = null; private String sessionId; private final String clientId; private int negotiatedVersion = -1; @@ -108,9 +111,13 @@ class ApacheGatewayConnection implements GatewayConnection { if (httpClient != null) log.log(Level.WARNING, "Previous httpClient still exists."); httpClient = httpClientFactory.createClient(); + connectionTime = Clock.systemUTC().instant(); return httpClient != null; } + @Override + public Instant connectionTime() { return connectionTime; } + // Protected for easier testing only. protected static InputStreamEntity zipAndCreateEntity(final InputStream inputStream) throws IOException { byte[] buffer = new byte[4096]; |