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() {
2061
2061
this .prevNumSessionsAcquired = SessionPool .this .numSessionsAcquired ;
2062
2062
}
2063
2063
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
+
2064
2071
removeIdleSessions (currTime );
2065
2072
// Now go over all the remaining sessions and see if they need to be kept alive explicitly.
2066
2073
keepAliveSessions (currTime );
@@ -2309,6 +2316,9 @@ enum Position {
2309
2316
@ GuardedBy ("lock" )
2310
2317
private int maxSessionsInUse = 0 ;
2311
2318
2319
+ @ GuardedBy ("lock" )
2320
+ private Instant lastResetTime = Clock .INSTANCE .instant ();
2321
+
2312
2322
@ GuardedBy ("lock" )
2313
2323
private long numSessionsAcquired = 0 ;
2314
2324
You can’t perform that action at this time.
0 commit comments