diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java b/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java index 6a6a1c7cd6af..ed54e6a94111 100644 --- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java +++ b/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java @@ -262,6 +262,7 @@ public void setUp() { options = BigQueryOptions.builder() .projectId(PROJECT) .serviceRpcFactory(rpcFactoryMock) + .retryParams(RetryParams.noRetries()) .build(); } diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java b/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java index 6ed1d50ba364..84bb07195806 100644 --- a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java +++ b/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java @@ -264,7 +264,8 @@ public B authCredentials(AuthCredentials authCredentials) { /** * Sets configuration parameters for request retries. If no configuration is set - * {@link RetryParams#noRetries()} is used. + * {@link RetryParams#defaultInstance()} is used. To disable retries, supply + * {@link RetryParams#noRetries()} here. * * @return the builder */ @@ -325,7 +326,7 @@ protected ServiceOptions(Class> ser authCredentials = builder.authCredentials != null ? builder.authCredentials : defaultAuthCredentials(); authCredentialsState = authCredentials != null ? authCredentials.capture() : null; - retryParams = builder.retryParams; + retryParams = firstNonNull(builder.retryParams, RetryParams.defaultInstance()); serviceFactory = firstNonNull(builder.serviceFactory, getFromServiceLoader(serviceFactoryClass, defaultServiceFactory())); serviceFactoryClassName = serviceFactory.getClass().getName(); diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java b/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java index 029b161c1c38..0e9b993483b0 100644 --- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java +++ b/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java @@ -125,6 +125,7 @@ public void setUp() { options = DatastoreOptions.builder() .projectId(PROJECT_ID) .host("http://localhost:" + PORT) + .retryParams(RetryParams.noRetries()) .build(); datastore = options.service(); StructuredQuery query = Query.keyQueryBuilder().build(); diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java b/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java index a6f65ec705e4..dc3dba6c72ab 100644 --- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java +++ b/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java @@ -18,7 +18,6 @@ import com.google.gcloud.AuthCredentials; import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials; -import com.google.gcloud.RetryParams; import com.google.gcloud.spi.StorageRpc.Tuple; import com.google.gcloud.storage.Blob; import com.google.gcloud.storage.BlobId; @@ -549,8 +548,7 @@ public static void main(String... args) throws Exception { printUsage(); return; } - StorageOptions.Builder optionsBuilder = - StorageOptions.builder().retryParams(RetryParams.defaultInstance()); + StorageOptions.Builder optionsBuilder = StorageOptions.builder(); StorageAction action; String actionName; if (args.length >= 2 && !ACTIONS.containsKey(args[0])) { diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java index 1210e4ec81a7..fedd10eacdc6 100644 --- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java +++ b/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java @@ -25,7 +25,6 @@ import com.google.common.collect.ImmutableMap; import com.google.gcloud.Page; -import com.google.gcloud.RetryParams; import com.google.gcloud.resourcemanager.ProjectInfo.ResourceId; import com.google.gcloud.resourcemanager.ResourceManager.ProjectField; import com.google.gcloud.resourcemanager.ResourceManager.ProjectGetOption; @@ -271,7 +270,6 @@ public void testRetryableException() { EasyMock.replay(rpcFactoryMock); ResourceManager resourceManagerMock = ResourceManagerOptions.builder() .serviceRpcFactory(rpcFactoryMock) - .retryParams(RetryParams.defaultInstance()) .build() .service(); EasyMock.expect(resourceManagerRpcMock.get(PARTIAL_PROJECT.projectId(), EMPTY_RPC_OPTIONS)) @@ -291,7 +289,6 @@ public void testNonRetryableException() { EasyMock.replay(rpcFactoryMock); ResourceManager resourceManagerMock = ResourceManagerOptions.builder() .serviceRpcFactory(rpcFactoryMock) - .retryParams(RetryParams.defaultInstance()) .build() .service(); EasyMock.expect(resourceManagerRpcMock.get(PARTIAL_PROJECT.projectId(), EMPTY_RPC_OPTIONS)) diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelImplTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelImplTest.java index d943715580c9..7daf4a6fb468 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelImplTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelImplTest.java @@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableMap; import com.google.gcloud.RestorableState; +import com.google.gcloud.RetryParams; import com.google.gcloud.spi.StorageRpc; import com.google.gcloud.spi.StorageRpcFactory; @@ -65,6 +66,7 @@ public void setUp() { options = StorageOptions.builder() .projectId("projectId") .serviceRpcFactory(rpcFactoryMock) + .retryParams(RetryParams.noRetries()) .build(); } diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelImplTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelImplTest.java index 952be543a913..518ba8e14c65 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelImplTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelImplTest.java @@ -32,6 +32,7 @@ import com.google.common.collect.ImmutableMap; import com.google.gcloud.RestorableState; +import com.google.gcloud.RetryParams; import com.google.gcloud.spi.StorageRpc; import com.google.gcloud.spi.StorageRpcFactory; @@ -74,6 +75,7 @@ public void setUp() { options = StorageOptions.builder() .projectId("projectid") .serviceRpcFactory(rpcFactoryMock) + .retryParams(RetryParams.noRetries()) .build(); } diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java index f14ee934638f..1b1ffd987de6 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java @@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableMap; import com.google.gcloud.RestorableState; +import com.google.gcloud.RetryParams; import com.google.gcloud.spi.StorageRpc; import com.google.gcloud.spi.StorageRpc.RewriteRequest; import com.google.gcloud.spi.StorageRpc.RewriteResponse; @@ -72,6 +73,7 @@ public void setUp() { options = StorageOptions.builder() .projectId("projectid") .serviceRpcFactory(rpcFactoryMock) + .retryParams(RetryParams.noRetries()) .build(); } diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java index 007ac4b2a15a..3aaec047714f 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java @@ -261,6 +261,7 @@ public void setUp() { .projectId("projectId") .clock(TIME_SOURCE) .serviceRpcFactory(rpcFactoryMock) + .retryParams(RetryParams.noRetries()) .build(); }