From cb3495efa865ec68025b0d7851816010cb3c4b14 Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Tue, 31 Dec 2024 12:24:14 +0530 Subject: [PATCH] review comments --- .../src/main/java/com/google/cloud/spanner/SessionPool.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 104e31dab21..e560ca71deb 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -2048,7 +2048,7 @@ boolean isClosed() { // Does various pool maintenance activities. void maintainPool() { - Instant currTime = clock.instant(); + Instant currTime; synchronized (lock) { if (SessionPool.this.isClosed()) { return; @@ -2061,6 +2061,7 @@ void maintainPool() { } this.prevNumSessionsAcquired = SessionPool.this.numSessionsAcquired; + currTime = clock.instant(); // Reset the start time for recording the maximum number of sessions in the pool if (currTime.isAfter(SessionPool.this.lastResetTime.plus(Duration.ofMinutes(10)))) { SessionPool.this.maxSessionsInUse = SessionPool.this.numSessionsInUse;