Skip to content

Commit 239fc92

Browse files
committed
---
yaml --- r: 5923 b: refs/heads/tswast-patch-1 c: 963f8ae h: refs/heads/master i: 5921: c873ef1 5919: 42ea42a
1 parent 89f6854 commit 239fc92

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 894541860cdc6da9babd6ab1b3d66392f020d6bb
60+
refs/heads/tswast-patch-1: 963f8ae1a1595ffcb87268c6bd60983d69427f09
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/src/main/java/com/google/gcloud/ExceptionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private ExceptionHandler(Builder builder) {
187187
nonRetriableExceptions = builder.nonRetriableExceptions.build();
188188
Preconditions.checkArgument(
189189
Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(),
190-
"Same exception was found in both retriable and non-retriable sets");
190+
"Same exception was found in both retryable and non-retryable sets");
191191
for (Class<? extends Exception> exception : retriableExceptions) {
192192
addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.RETRY), retryInfo);
193193
}

branches/tswast-patch-1/src/main/java/com/google/gcloud/datastore/DatastoreServiceException.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ public enum Code {
5252
RESOURCE_EXHAUSTED(Reason.RESOURCE_EXHAUSTED),
5353
UNKNOWN(false, "Unknown failure", -1);
5454

55-
private final boolean retriable;
55+
private final boolean retryable;
5656
private final String description;
5757
private final int httpStatus;
5858

5959
Code(Reason reason) {
6060
this(reason.retryable(), reason.description(), reason.httpStatus());
6161
}
6262

63-
Code(boolean retriable, String description, int httpStatus) {
64-
this.retriable = retriable;
63+
Code(boolean retryable, String description, int httpStatus) {
64+
this.retryable = retryable;
6565
this.description = description;
6666
this.httpStatus = httpStatus;
6767
}
@@ -78,8 +78,8 @@ public int httpStatus() {
7878
* Returns {@code true} if this exception is transient and the same request could be retried.
7979
* For any retry it is highly recommended to apply an exponential backoff.
8080
*/
81-
public boolean retriable() {
82-
return retriable;
81+
public boolean retryable() {
82+
return retryable;
8383
}
8484

8585
DatastoreServiceException translate(DatastoreRpcException exception, String message) {

branches/tswast-patch-1/src/main/java/com/google/gcloud/datastore/DatastoreServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public RetryResult afterEval(Exception exception, RetryResult retryResult) {
6161
@Override
6262
public RetryResult beforeEval(Exception exception) {
6363
if (exception instanceof DatastoreRpcException) {
64-
boolean retriable = ((DatastoreRpcException) exception).retryable();
65-
return retriable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.ABORT;
64+
boolean retryable = ((DatastoreRpcException) exception).retryable();
65+
return retryable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.ABORT;
6666
}
6767
return null;
6868
}

branches/tswast-patch-1/src/test/java/com/google/gcloud/datastore/DatastoreServiceExceptionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.google.gcloud.datastore;import static junit.framework.TestCase.fail;import static org.junit.Assert.assertEquals;import com.google.gcloud.spi.DatastoreRpc.DatastoreRpcException;import com.google.gcloud.spi.DatastoreRpc.DatastoreRpcException.Reason;import com.google.gcloud.datastore.DatastoreServiceException.Code;import org.junit.Test;public class DatastoreServiceExceptionTest { @Test public void testCode() throws Exception { for (Reason reason : Reason.values()) { Code code = Code.valueOf(reason.name()); assertEquals(reason.retryable(), code.retriable()); assertEquals(reason.description(), code.description()); assertEquals(reason.httpStatus(), code.httpStatus()); } DatastoreServiceException exception = new DatastoreServiceException(Code.ABORTED, "bla"); assertEquals(Code.ABORTED, exception.code()); } @Test public void testTranslateAndThrow() throws Exception { for (Reason reason : Reason.values()) { try { DatastoreServiceException.translateAndThrow(new DatastoreRpcException(reason)); fail("Exception expected"); } catch (DatastoreServiceException ex) { assertEquals(reason.name(), ex.code().name()); } } } @Test public void testThrowInvalidRequest() throws Exception { try { DatastoreServiceException.throwInvalidRequest("message %s %d", "a", 1); fail("Exception expected"); } catch (DatastoreServiceException ex) { assertEquals(Code.FAILED_PRECONDITION, ex.code()); assertEquals("message a 1", ex.getMessage()); } }}
1+
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.google.gcloud.datastore;import static junit.framework.TestCase.fail;import static org.junit.Assert.assertEquals;import com.google.gcloud.spi.DatastoreRpc.DatastoreRpcException;import com.google.gcloud.spi.DatastoreRpc.DatastoreRpcException.Reason;import com.google.gcloud.datastore.DatastoreServiceException.Code;import org.junit.Test;public class DatastoreServiceExceptionTest { @Test public void testCode() throws Exception { for (Reason reason : Reason.values()) { Code code = Code.valueOf(reason.name()); assertEquals(reason.retryable(), code.retryable()); assertEquals(reason.description(), code.description()); assertEquals(reason.httpStatus(), code.httpStatus()); } DatastoreServiceException exception = new DatastoreServiceException(Code.ABORTED, "bla"); assertEquals(Code.ABORTED, exception.code()); } @Test public void testTranslateAndThrow() throws Exception { for (Reason reason : Reason.values()) { try { DatastoreServiceException.translateAndThrow(new DatastoreRpcException(reason)); fail("Exception expected"); } catch (DatastoreServiceException ex) { assertEquals(reason.name(), ex.code().name()); } } } @Test public void testThrowInvalidRequest() throws Exception { try { DatastoreServiceException.throwInvalidRequest("message %s %d", "a", 1); fail("Exception expected"); } catch (DatastoreServiceException ex) { assertEquals(Code.FAILED_PRECONDITION, ex.code()); assertEquals("message a 1", ex.getMessage()); } }}

0 commit comments

Comments
 (0)