Skip to content

Commit 586a74e

Browse files
committed
---
yaml --- r: 2175 b: refs/heads/pubsub-alpha c: acf260c h: refs/heads/master i: 2173: d0201fd 2171: 9801f08 2167: 09fa36f 2159: 2c7be82 2143: 39398f6 2111: baf9e48 2047: 9b1d5b2
1 parent 90933f5 commit 586a74e

6 files changed

Lines changed: 27 additions & 98 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: 03d5d30313281209550730375df7a0bbe8f4d284
6+
refs/heads/pubsub-alpha: acf260ce07f7fdd0729682d74c15c5c88abf7c84
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryImpl.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
import com.google.common.collect.Lists;
3535
import com.google.common.collect.Maps;
3636
import com.google.gcloud.BaseService;
37-
import com.google.gcloud.ExceptionHandler;
38-
import com.google.gcloud.ExceptionHandler.Interceptor;
3937
import com.google.gcloud.Page;
4038
import com.google.gcloud.PageImpl;
4139
import com.google.gcloud.PageImpl.NextPageFetcher;
@@ -49,27 +47,6 @@
4947

5048
final class BigQueryImpl extends BaseService<BigQueryOptions> implements BigQuery {
5149

52-
private static final Interceptor EXCEPTION_HANDLER_INTERCEPTOR = new Interceptor() {
53-
54-
private static final long serialVersionUID = -7478333733015750774L;
55-
56-
@Override
57-
public RetryResult afterEval(Exception exception, RetryResult retryResult) {
58-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
59-
}
60-
61-
@Override
62-
public RetryResult beforeEval(Exception exception) {
63-
if (exception instanceof BigQueryException) {
64-
boolean retriable = ((BigQueryException) exception).retryable();
65-
return retriable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.NO_RETRY;
66-
}
67-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
68-
}
69-
};
70-
static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.builder()
71-
.abortOn(RuntimeException.class).interceptor(EXCEPTION_HANDLER_INTERCEPTOR).build();
72-
7350
private static class DatasetPageFetcher implements NextPageFetcher<DatasetInfo> {
7451

7552
private static final long serialVersionUID = -3057564042439021278L;

branches/pubsub-alpha/gcloud-java-core/src/main/java/com/google/gcloud/BaseService.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.google.gcloud;
1818

19+
import com.google.gcloud.ExceptionHandler.Interceptor;
20+
1921
/**
2022
* Base class for service objects.
2123
*
@@ -24,6 +26,29 @@
2426
public abstract class BaseService<OptionsT extends ServiceOptions<?, ?, OptionsT>>
2527
implements Service<OptionsT> {
2628

29+
public static final Interceptor EXCEPTION_HANDLER_INTERCEPTOR = new Interceptor() {
30+
31+
private static final long serialVersionUID = -8429573486870467828L;
32+
33+
@Override
34+
public RetryResult afterEval(Exception exception, RetryResult retryResult) {
35+
return Interceptor.RetryResult.CONTINUE_EVALUATION;
36+
}
37+
38+
@Override
39+
public RetryResult beforeEval(Exception exception) {
40+
if (exception instanceof BaseServiceException) {
41+
boolean retriable = ((BaseServiceException) exception).retryable();
42+
return retriable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.NO_RETRY;
43+
}
44+
return Interceptor.RetryResult.CONTINUE_EVALUATION;
45+
}
46+
};
47+
public static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.builder()
48+
.abortOn(RuntimeException.class)
49+
.interceptor(EXCEPTION_HANDLER_INTERCEPTOR)
50+
.build();
51+
2752
private final OptionsT options;
2853

2954
protected BaseService(OptionsT options) {

branches/pubsub-alpha/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreImpl.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import com.google.common.collect.ImmutableList;
2424
import com.google.common.collect.Sets;
2525
import com.google.gcloud.BaseService;
26-
import com.google.gcloud.ExceptionHandler;
27-
import com.google.gcloud.ExceptionHandler.Interceptor;
2826
import com.google.gcloud.RetryHelper;
2927
import com.google.gcloud.RetryHelper.RetryHelperException;
3028
import com.google.gcloud.RetryParams;
@@ -41,31 +39,7 @@
4139
import java.util.Set;
4240
import java.util.concurrent.Callable;
4341

44-
final class DatastoreImpl extends BaseService<DatastoreOptions>
45-
implements Datastore {
46-
47-
private static final Interceptor EXCEPTION_HANDLER_INTERCEPTOR =
48-
new Interceptor() {
49-
50-
private static final long serialVersionUID = 6911242958397733203L;
51-
52-
@Override
53-
public RetryResult afterEval(Exception exception, RetryResult retryResult) {
54-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
55-
}
56-
57-
@Override
58-
public RetryResult beforeEval(Exception exception) {
59-
if (exception instanceof DatastoreException) {
60-
boolean retryable = ((DatastoreException) exception).retryable();
61-
return retryable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.NO_RETRY;
62-
}
63-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
64-
}
65-
};
66-
private static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.builder()
67-
.abortOn(RuntimeException.class, DatastoreException.class)
68-
.interceptor(EXCEPTION_HANDLER_INTERCEPTOR).build();
42+
final class DatastoreImpl extends BaseService<DatastoreOptions> implements Datastore {
6943

7044
private final DatastoreRpc datastoreRpc;
7145
private final RetryParams retryParams;

branches/pubsub-alpha/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import com.google.common.collect.Iterables;
2626
import com.google.common.collect.Maps;
2727
import com.google.gcloud.BaseService;
28-
import com.google.gcloud.ExceptionHandler;
29-
import com.google.gcloud.ExceptionHandler.Interceptor;
3028
import com.google.gcloud.Page;
3129
import com.google.gcloud.PageImpl;
3230
import com.google.gcloud.PageImpl.NextPageFetcher;
@@ -40,29 +38,6 @@
4038
final class ResourceManagerImpl
4139
extends BaseService<ResourceManagerOptions> implements ResourceManager {
4240

43-
private static final Interceptor EXCEPTION_HANDLER_INTERCEPTOR = new Interceptor() {
44-
45-
private static final long serialVersionUID = 2091576149969931704L;
46-
47-
@Override
48-
public RetryResult afterEval(Exception exception, RetryResult retryResult) {
49-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
50-
}
51-
52-
@Override
53-
public RetryResult beforeEval(Exception exception) {
54-
if (exception instanceof ResourceManagerException) {
55-
boolean retriable = ((ResourceManagerException) exception).retryable();
56-
return retriable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.NO_RETRY;
57-
}
58-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
59-
}
60-
};
61-
static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.builder()
62-
.abortOn(RuntimeException.class)
63-
.interceptor(EXCEPTION_HANDLER_INTERCEPTOR)
64-
.build();
65-
6641
private final ResourceManagerRpc resourceManagerRpc;
6742

6843
ResourceManagerImpl(ResourceManagerOptions options) {

branches/pubsub-alpha/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
import com.google.common.primitives.Ints;
4545
import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
4646
import com.google.gcloud.BaseService;
47-
import com.google.gcloud.ExceptionHandler;
48-
import com.google.gcloud.ExceptionHandler.Interceptor;
4947
import com.google.gcloud.Page;
5048
import com.google.gcloud.PageImpl;
5149
import com.google.gcloud.PageImpl.NextPageFetcher;
@@ -76,26 +74,6 @@
7674

7775
final class StorageImpl extends BaseService<StorageOptions> implements Storage {
7876

79-
private static final Interceptor EXCEPTION_HANDLER_INTERCEPTOR = new Interceptor() {
80-
81-
private static final long serialVersionUID = -7758580330857881124L;
82-
83-
@Override
84-
public RetryResult afterEval(Exception exception, RetryResult retryResult) {
85-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
86-
}
87-
88-
@Override
89-
public RetryResult beforeEval(Exception exception) {
90-
if (exception instanceof StorageException) {
91-
boolean retriable = ((StorageException) exception).retryable();
92-
return retriable ? Interceptor.RetryResult.RETRY : Interceptor.RetryResult.NO_RETRY;
93-
}
94-
return Interceptor.RetryResult.CONTINUE_EVALUATION;
95-
}
96-
};
97-
static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.builder()
98-
.abortOn(RuntimeException.class).interceptor(EXCEPTION_HANDLER_INTERCEPTOR).build();
9977
private static final byte[] EMPTY_BYTE_ARRAY = {};
10078
private static final String EMPTY_BYTE_ARRAY_MD5 = "1B2M2Y8AsgTpgAmY7PhCfg==";
10179
private static final String EMPTY_BYTE_ARRAY_CRC32C = "AAAAAA==";

0 commit comments

Comments
 (0)