File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -556,7 +556,11 @@ Builder setCredentials(Credentials credentials) {
556556 return this ;
557557 }
558558
559- Builder setStatementExecutorType (StatementExecutorType statementExecutorType ) {
559+ /**
560+ * Sets the executor type to use for connections. See {@link StatementExecutorType} for more
561+ * information on what the different options mean.
562+ */
563+ public Builder setStatementExecutorType (StatementExecutorType statementExecutorType ) {
560564 this .statementExecutorType = statementExecutorType ;
561565 return this ;
562566 }
@@ -920,7 +924,11 @@ CredentialsProvider getCredentialsProvider() {
920924 return getInitialConnectionPropertyValue (CREDENTIALS_PROVIDER );
921925 }
922926
923- StatementExecutorType getStatementExecutorType () {
927+ /**
928+ * Returns the executor type that is used by connections that are created from this {@link
929+ * ConnectionOptions} instance.
930+ */
931+ public StatementExecutorType getStatementExecutorType () {
924932 return this .statementExecutorType ;
925933 }
926934
Original file line number Diff line number Diff line change @@ -172,9 +172,23 @@ private static ListeningExecutorService createExecutorService(StatementExecutorT
172172 */
173173 private final List <StatementExecutionInterceptor > interceptors ;
174174
175- enum StatementExecutorType {
175+ /** The executor type that is used for statements that are executed on a connection. */
176+ public enum StatementExecutorType {
177+ /**
178+ * Use a platform thread per connection. This allows async execution of statements, but costs
179+ * more resources than the other options.
180+ */
176181 PLATFORM_THREAD ,
182+ /**
183+ * Use a virtual thread per connection. This allows async execution of statements. Virtual
184+ * threads are only supported on Java 21 and higher.
185+ */
177186 VIRTUAL_THREAD ,
187+ /**
188+ * Use the calling thread for execution. This does not support async execution of statements.
189+ * This option is used by drivers that do not support async execution, such as JDBC and
190+ * PGAdapter.
191+ */
178192 DIRECT_EXECUTOR ,
179193 }
180194
You can’t perform that action at this time.
0 commit comments