public static class SessionPoolOptions.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SessionPoolOptions |
build()
Build a SessionPoolOption object
|
SessionPoolOptions.Builder |
setAutoDetectDialect(boolean autoDetectDialect)
Sets whether the client should automatically execute a background query to detect the dialect
that is used by the database or not.
|
SessionPoolOptions.Builder |
setBlockIfPoolExhausted()
If all sessions are in use and there is no more room for creating new sessions, block for a
session to become available.
|
SessionPoolOptions.Builder |
setFailIfPoolExhausted()
If all sessions are in use and and
maxSessions has been reached, fail the request by
throwing a SpannerException with the error code RESOURCE_EXHAUSTED . |
SessionPoolOptions.Builder |
setKeepAliveIntervalMinutes(int intervalMinutes)
How frequently to keep alive idle sessions.
|
SessionPoolOptions.Builder |
setMaxIdleSessions(int maxIdleSessions)
Deprecated.
set a higher value for
setMinSessions(int) instead of using this
configuration option. This option will be removed in a future release. |
SessionPoolOptions.Builder |
setMaxSessions(int maxSessions)
Maximum number of sessions that this pool will have.
|
SessionPoolOptions.Builder |
setMinSessions(int minSessions)
Minimum number of sessions that this pool will always maintain.
|
SessionPoolOptions.Builder |
setRemoveInactiveSessionAfter(org.threeten.bp.Duration duration) |
SessionPoolOptions.Builder |
setWriteSessionsFraction(float writeSessionsFraction)
Deprecated.
This configuration value is no longer in use. The session pool does not prepare
any sessions for read/write transactions. Instead, a transaction will automatically be
started by the first statement that is executed by a transaction by including a
BeginTransaction option with that statement.
This method may be removed in a future release. |
public SessionPoolOptions.Builder setMinSessions(int minSessions)
public SessionPoolOptions.Builder setMaxSessions(int maxSessions)
@Deprecated public SessionPoolOptions.Builder setMaxIdleSessions(int maxIdleSessions)
setMinSessions(int)
instead of using this
configuration option. This option will be removed in a future release.setMinSessions(int)
. To determine how many sessions are idle we look at maximum number of
sessions used concurrently over a window of time. Any sessions beyond that are idle. Defaults
to 0.public SessionPoolOptions.Builder setRemoveInactiveSessionAfter(org.threeten.bp.Duration duration)
public SessionPoolOptions.Builder setKeepAliveIntervalMinutes(int intervalMinutes)
public SessionPoolOptions.Builder setFailIfPoolExhausted()
maxSessions
has been reached, fail the request by
throwing a SpannerException
with the error code RESOURCE_EXHAUSTED
. Default
behavior is to block the request.public SessionPoolOptions.Builder setBlockIfPoolExhausted()
public SessionPoolOptions.Builder setAutoDetectDialect(boolean autoDetectDialect)
Note that you can always call DatabaseClient.getDialect()
to get the dialect of a
database regardless of this setting, but by setting this to true, the value will be
pre-populated and cached in the client.
autoDetectDialect
- Whether the client should automatically execute a background query
to detect the dialect of the underlying databasepublic SessionPoolOptions.Builder setWriteSessionsFraction(float writeSessionsFraction)
This method may be removed in a future release.
public SessionPoolOptions build()
Copyright © 2022 Google LLC. All rights reserved.