File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -2061,6 +2061,13 @@ void maintainPool() {
20612061 this .prevNumSessionsAcquired = SessionPool .this .numSessionsAcquired ;
20622062 }
20632063 Instant currTime = clock .instant ();
2064+
2065+ // Reset the start time for recording the maximum number of sessions in the pool
2066+ if (currTime .isAfter (SessionPool .this .lastResetTime .plus (Duration .ofMinutes (10 )))) {
2067+ SessionPool .this .maxSessionsInUse = SessionPool .this .numSessionsInUse ;
2068+ SessionPool .this .lastResetTime = currTime ;
2069+ }
2070+
20642071 removeIdleSessions (currTime );
20652072 // Now go over all the remaining sessions and see if they need to be kept alive explicitly.
20662073 keepAliveSessions (currTime );
@@ -2309,6 +2316,9 @@ enum Position {
23092316 @ GuardedBy ("lock" )
23102317 private int maxSessionsInUse = 0 ;
23112318
2319+ @ GuardedBy ("lock" )
2320+ private Instant lastResetTime = Clock .INSTANCE .instant ();
2321+
23122322 @ GuardedBy ("lock" )
23132323 private long numSessionsAcquired = 0 ;
23142324
You can’t perform that action at this time.
0 commit comments