File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -2060,7 +2060,15 @@ void maintainPool() {
20602060 }
20612061 this .prevNumSessionsAcquired = SessionPool .this .numSessionsAcquired ;
20622062 }
2063+
2064+ // Reset the start time for recording the maximum number of sessions
2065+ // in the pool.
20632066 Instant currTime = clock .instant ();
2067+ if (currTime .isAfter (SessionPool .this .lastResetTime .plus (Duration .ofMinutes (10 )))) {
2068+ SessionPool .this .maxSessionsInUse = SessionPool .this .numSessionsInUse ;
2069+ SessionPool .this .lastResetTime = currTime ;
2070+ }
2071+
20642072 removeIdleSessions (currTime );
20652073 // Now go over all the remaining sessions and see if they need to be kept alive explicitly.
20662074 keepAliveSessions (currTime );
@@ -2309,6 +2317,9 @@ enum Position {
23092317 @ GuardedBy ("lock" )
23102318 private int maxSessionsInUse = 0 ;
23112319
2320+ @ GuardedBy ("lock" )
2321+ private Instant lastResetTime = Clock .INSTANCE .instant ();
2322+
23122323 @ GuardedBy ("lock" )
23132324 private long numSessionsAcquired = 0 ;
23142325
You can’t perform that action at this time.
0 commit comments