Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 160a049

Browse files
committed
deprecation: deprecate MaxIdleSessions configuration option
1 parent ec99cc7 commit 160a049

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ public class SessionPoolOptions {
3131
private final int minSessions;
3232
private final int maxSessions;
3333
private final int incStep;
34-
private final int maxIdleSessions;
34+
/**
35+
* Use {@link #minSessions} instead to set the minimum number of sessions in the pool to maintain.
36+
* Creating a larger number of sessions during startup is relatively cheap as it is executed with
37+
* the BatchCreateSessions RPC.
38+
*/
39+
@Deprecated private final int maxIdleSessions;
3540
/**
3641
* The session pool no longer prepares a fraction of the sessions with a read/write transaction.
3742
* This setting therefore does not have any meaning anymore, and may be removed in the future.
@@ -118,6 +123,11 @@ int getIncStep() {
118123
return incStep;
119124
}
120125

126+
/**
127+
* @deprecated Use a higher value for {@link SessionPoolOptions.Builder#setMinSessions(int)}
128+
* instead of setting this option.
129+
*/
130+
@Deprecated
121131
public int getMaxIdleSessions() {
122132
return maxIdleSessions;
123133
}
@@ -193,7 +203,10 @@ public static class Builder {
193203
private int minSessions = DEFAULT_MIN_SESSIONS;
194204
private int maxSessions = DEFAULT_MAX_SESSIONS;
195205
private int incStep = DEFAULT_INC_STEP;
196-
private int maxIdleSessions;
206+
207+
/** Set a higher value for {@link #minSessions} instead of using {@link #maxIdleSessions}. */
208+
@Deprecated private int maxIdleSessions;
209+
197210
/**
198211
* The session pool no longer prepares a fraction of the sessions with a read/write transaction.
199212
* This setting therefore does not have any meaning anymore, and may be removed in the future.
@@ -265,7 +278,11 @@ Builder setIncStep(int incStep) {
265278
* #setMinSessions}. To determine how many sessions are idle we look at maximum number of
266279
* sessions used concurrently over a window of time. Any sessions beyond that are idle. Defaults
267280
* to 0.
281+
*
282+
* @deprecated set a higher value for {@link #setMinSessions(int)} instead of using this
283+
* configuration option. This option will be removed in a future release.
268284
*/
285+
@Deprecated
269286
public Builder setMaxIdleSessions(int maxIdleSessions) {
270287
this.maxIdleSessions = maxIdleSessions;
271288
return this;

0 commit comments

Comments
 (0)