diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg index 9640e74d45..5a95c68284 100644 --- a/.kokoro/nightly/integration.cfg +++ b/.kokoro/nightly/integration.cfg @@ -13,12 +13,12 @@ env_vars: { # TODO: remove this after we've migrated all tests and scripts env_vars: { key: "GCLOUD_PROJECT" - value: "cloud-java-ci-sample" + value: "java-docs-samples-testing" } env_vars: { key: "GOOGLE_CLOUD_PROJECT" - value: "cloud-java-ci-sample" + value: "java-docs-samples-testing" } env_vars: { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java index 9793a50c63..d0c06fa1d9 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/AbstractStatementParser.java @@ -22,7 +22,9 @@ import com.google.cloud.spanner.SpannerException; import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.Statement; +import com.google.cloud.spanner.connection.AbstractBaseUnitOfWork.InterceptorsUsage; import com.google.cloud.spanner.connection.StatementResult.ClientSideStatementType; +import com.google.cloud.spanner.connection.UnitOfWork.CallType; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.cache.Cache; @@ -32,6 +34,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -71,12 +74,7 @@ static void resetParsers() { } } - /** - * Get an instance of {@link AbstractStatementParser} for the specified dialect. - * - * @param dialect - * @return - */ + /** Get an instance of {@link AbstractStatementParser} for the specified dialect. */ public static AbstractStatementParser getInstance(Dialect dialect) { synchronized (lock) { if (!INSTANCES.containsKey(dialect)) { @@ -86,19 +84,19 @@ public static AbstractStatementParser getInstance(Dialect dialect) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INTERNAL, "There is no known statement parser for dialect " + dialect); } - INSTANCES.put(dialect, clazz.newInstance()); - } catch (InstantiationException | IllegalAccessException e) { + INSTANCES.put(dialect, clazz.getDeclaredConstructor().newInstance()); + } catch (Exception exception) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INTERNAL, "Could not instantiate statement parser for dialect " + dialect.name(), - e); + exception); } } return INSTANCES.get(dialect); } } - /** + /* * The following fixed pre-parsed statements are used internally by the Connection API. These do * not need to be parsed using a specific dialect, as they are equal for all dialects, and * pre-parsing them avoids the need to repeatedly parse statements that are used internally. @@ -108,14 +106,16 @@ public static AbstractStatementParser getInstance(Dialect dialect) { static final ParsedStatement BEGIN_STATEMENT; /** - * Create a COMMIT statement to use with the {@link #commit()} method to allow it to be cancelled, - * time out or retried. + * Create a COMMIT statement to use with the {@link Connection#commit()} method to allow it to be + * cancelled, time out or retried. * - *

{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement, - * Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout - * and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link - * #commit()} method is called directly, we do not have a {@link ParsedStatement}, and the method - * uses this statement instead in order to use the same logic as the other statements. + *

{@link ReadWriteTransaction} uses the generic methods {@link + * ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, + * InterceptorsUsage, Collection)} and {@link ReadWriteTransaction#runWithRetry(Callable)} to + * allow statements to be cancelled, to timeout and to be retried. These methods require a {@link + * ParsedStatement} as input. When the {@link Connection#commit()} method is called directly, we + * do not have a {@link ParsedStatement}, and the method uses this statement instead in order to + * use the same logic as the other statements. */ static final ParsedStatement COMMIT_STATEMENT; @@ -123,15 +123,16 @@ public static AbstractStatementParser getInstance(Dialect dialect) { static final ParsedStatement ROLLBACK_STATEMENT; /** - * Create a RUN BATCH statement to use with the {@link #executeBatchUpdate(Iterable)} method to - * allow it to be cancelled, time out or retried. + * Create a RUN BATCH statement to use with the {@link Connection#executeBatchUpdate(Iterable)} + * method to allow it to be cancelled, time out or retried. * - *

{@link ReadWriteTransaction} uses the generic methods {@link #executeAsync(ParsedStatement, - * Callable)} and {@link #runWithRetry(Callable)} to allow statements to be cancelled, to timeout - * and to be retried. These methods require a {@link ParsedStatement} as input. When the {@link - * #executeBatchUpdate(Iterable)} method is called, we do not have one {@link ParsedStatement}, - * and the method uses this statement instead in order to use the same logic as the other - * statements. + *

{@link ReadWriteTransaction} uses the generic methods {@link + * ReadWriteTransaction#executeStatementAsync(CallType, ParsedStatement, Callable, Collection)} + * and {@link ReadWriteTransaction#runWithRetry(Callable)} to allow statements to be cancelled, to + * timeout and to be retried. These methods require a {@link ParsedStatement} as input. When the + * {@link Connection#executeBatchUpdate(Iterable)} method is called, we do not have one {@link + * ParsedStatement}, and the method uses this statement instead in order to use the same logic as + * the other statements. */ static final ParsedStatement RUN_BATCH_STATEMENT;