2727import java .util .Locale ;
2828import java .util .Objects ;
2929
30- /** Options for the session pool used by {@code DatabaseClient}. */
30+ /**
31+ * Options for the session pool used by {@code DatabaseClient}.
32+ *
33+ * @deprecated The Spanner Java client uses a single multiplexed session. All options related to the
34+ * session pool are no longer functional and will be removed in a future version.
35+ */
3136@ Deprecated
3237public class SessionPoolOptions {
38+ @ Deprecated
3339 enum Position {
3440 FIRST ,
3541 LAST ,
@@ -228,10 +234,12 @@ public Builder toBuilder() {
228234 return new Builder (this );
229235 }
230236
237+ @ Deprecated
231238 public int getMinSessions () {
232239 return minSessions ;
233240 }
234241
242+ @ Deprecated
235243 public int getMaxSessions () {
236244 return maxSessions ;
237245 }
@@ -268,6 +276,7 @@ Duration getMultiplexedSessionMaintenanceLoopFrequency() {
268276 return this .multiplexedSessionMaintenanceLoopFrequency ;
269277 }
270278
279+ @ Deprecated
271280 public int getKeepAliveIntervalMinutes () {
272281 return keepAliveIntervalMinutes ;
273282 }
@@ -278,14 +287,17 @@ public org.threeten.bp.Duration getRemoveInactiveSessionAfter() {
278287 return toThreetenDuration (getRemoveInactiveSessionAfterDuration ());
279288 }
280289
290+ @ Deprecated
281291 public Duration getRemoveInactiveSessionAfterDuration () {
282292 return removeInactiveSessionAfter ;
283293 }
284294
295+ @ Deprecated
285296 public boolean isFailIfPoolExhausted () {
286297 return actionOnExhaustion == ActionOnExhaustion .FAIL ;
287298 }
288299
300+ @ Deprecated
289301 public boolean isBlockIfPoolExhausted () {
290302 return actionOnExhaustion == ActionOnExhaustion .BLOCK ;
291303 }
@@ -333,6 +345,7 @@ Clock getPoolMaintainerClock() {
333345 return poolMaintainerClock ;
334346 }
335347
348+ @ Deprecated
336349 public boolean isTrackStackTraceOfSessionCheckout () {
337350 return trackStackTraceOfSessionCheckout ;
338351 }
@@ -687,6 +700,7 @@ private Builder(SessionPoolOptions options) {
687700 * Minimum number of sessions that this pool will always maintain. These will be created eagerly
688701 * in parallel. Defaults to 100.
689702 */
703+ @ Deprecated
690704 public Builder setMinSessions (int minSessions ) {
691705 Preconditions .checkArgument (minSessions >= 0 , "minSessions must be >= 0" );
692706 this .minSessionsSet = true ;
@@ -700,6 +714,7 @@ public Builder setMinSessions(int minSessions) {
700714 * operation. If current number of in use sessions is same as this and a new request comes, pool
701715 * can either block or fail. Defaults to 400.
702716 */
717+ @ Deprecated
703718 public Builder setMaxSessions (int maxSessions ) {
704719 Preconditions .checkArgument (maxSessions > 0 , "maxSessions must be > 0" );
705720 this .maxSessions = maxSessions ;
@@ -753,10 +768,12 @@ Builder setInactiveTransactionRemovalOptions(
753768 * instead.
754769 */
755770 @ ObsoleteApi ("Use setRemoveInactiveSessionAfterDuration(Duration) instead" )
771+ @ Deprecated
756772 public Builder setRemoveInactiveSessionAfter (org .threeten .bp .Duration duration ) {
757773 return setRemoveInactiveSessionAfterDuration (toJavaTimeDuration (duration ));
758774 }
759775
776+ @ Deprecated
760777 public Builder setRemoveInactiveSessionAfterDuration (Duration duration ) {
761778 this .removeInactiveSessionAfter = duration ;
762779 return this ;
@@ -767,16 +784,18 @@ public Builder setRemoveInactiveSessionAfterDuration(Duration duration) {
767784 * is automatically closed after 60 minutes. Sessions will be kept alive by sending a dummy
768785 * query "Select 1". Default value is 30 minutes.
769786 */
787+ @ Deprecated
770788 public Builder setKeepAliveIntervalMinutes (int intervalMinutes ) {
771789 this .keepAliveIntervalMinutes = intervalMinutes ;
772790 return this ;
773791 }
774792
775793 /**
776- * If all sessions are in use and and {@code maxSessions} has been reached, fail the request by
794+ * If all sessions are in use and {@code maxSessions} has been reached, fail the request by
777795 * throwing a {@link SpannerException} with the error code {@code RESOURCE_EXHAUSTED}. Default
778796 * behavior is to block the request.
779797 */
798+ @ Deprecated
780799 public Builder setFailIfPoolExhausted () {
781800 this .actionOnExhaustion = ActionOnExhaustion .FAIL ;
782801 return this ;
@@ -791,6 +810,7 @@ public Builder setFailIfPoolExhausted() {
791810 * different period use the option {@link Builder#setAcquireSessionTimeoutDuration(Duration)}
792811 * ()}
793812 */
813+ @ Deprecated
794814 public Builder setBlockIfPoolExhausted () {
795815 this .actionOnExhaustion = ActionOnExhaustion .BLOCK ;
796816 return this ;
@@ -806,6 +826,7 @@ public Builder setBlockIfPoolExhausted() {
806826 *
807827 * @return this builder for chaining
808828 */
829+ @ Deprecated
809830 public Builder setWarnIfInactiveTransactions () {
810831 this .inactiveTransactionRemovalOptions =
811832 InactiveTransactionRemovalOptions .newBuilder ()
@@ -825,6 +846,7 @@ public Builder setWarnIfInactiveTransactions() {
825846 *
826847 * @return this builder for chaining
827848 */
849+ @ Deprecated
828850 public Builder setWarnAndCloseIfInactiveTransactions () {
829851 this .inactiveTransactionRemovalOptions =
830852 InactiveTransactionRemovalOptions .newBuilder ()
@@ -976,6 +998,7 @@ Builder setFailOnSessionLeak() {
976998 * <p>Some monitoring tools might log these exceptions even though they are not thrown. This
977999 * option can be used to suppress the creation and logging of these exceptions.
9781000 */
1001+ @ Deprecated
9791002 public Builder setTrackStackTraceOfSessionCheckout (boolean trackStackTraceOfSessionCheckout ) {
9801003 this .trackStackTraceOfSessionCheckout = trackStackTraceOfSessionCheckout ;
9811004 return this ;
@@ -988,6 +1011,7 @@ public Builder setTrackStackTraceOfSessionCheckout(boolean trackStackTraceOfSess
9881011 * BeginTransaction option with that statement.
9891012 * <p>This method may be removed in a future release.
9901013 */
1014+ @ Deprecated
9911015 public Builder setWriteSessionsFraction (float writeSessionsFraction ) {
9921016 this .writeSessionsFraction = writeSessionsFraction ;
9931017 return this ;
@@ -1016,6 +1040,7 @@ public Builder setWaitForMinSessionsDuration(Duration waitForMinSessions) {
10161040
10171041 /** This method is obsolete. Use {@link #setAcquireSessionTimeoutDuration(Duration)} instead. */
10181042 @ ObsoleteApi ("Use setAcquireSessionTimeoutDuration(Duration) instead" )
1043+ @ Deprecated
10191044 public Builder setAcquireSessionTimeout (org .threeten .bp .Duration acquireSessionTimeout ) {
10201045 return setAcquireSessionTimeoutDuration (toJavaTimeDuration (acquireSessionTimeout ));
10211046 }
@@ -1024,6 +1049,7 @@ public Builder setAcquireSessionTimeout(org.threeten.bp.Duration acquireSessionT
10241049 * If greater than zero, we wait for said duration when no sessions are available in the
10251050 * SessionPool. The default is a 60s timeout. Set the value to null to disable the timeout.
10261051 */
1052+ @ Deprecated
10271053 public Builder setAcquireSessionTimeoutDuration (Duration acquireSessionTimeout ) {
10281054 try {
10291055 if (acquireSessionTimeout != null ) {
0 commit comments