Skip to content

Commit 763edc7

Browse files
javabrownsduskis
authored andcommitted
---
yaml --- r: 16341 b: refs/heads/autosynth-iot c: e9ea3d9 h: refs/heads/master i: 16339: 62c73b9
1 parent b354504 commit 763edc7

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

  • branches/autosynth-iot/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ refs/heads/autosynth-datastore: 9acd400b484d6691a080c9152a331d88d24fefc1
133133
refs/heads/autosynth-dialogflow: d7477419376eac9b6dcc7dbcede581152527351d
134134
refs/heads/autosynth-errorreporting: 9891e73a56af7c097829ca7a521b0e862ba6af30
135135
refs/heads/autosynth-firestore: ddb29f8ee445a938fc40be8227dea87b3f508ab3
136-
refs/heads/autosynth-iot: 36fbd97799e222fac888ca5e643beb37d6700c77
136+
refs/heads/autosynth-iot: e9ea3d9bacf0410ef578a9d5c2d25fcbe5955a0d
137137
refs/heads/autosynth-kms: dcc6e15d68759010c8735cc868135bd7e6c1cc5f
138138
refs/heads/autosynth-language: 8972866b016473559702424205ce5569de47b34d
139139
refs/heads/autosynth-os-login: daa910328b954bbe87068f684a3088ed910f1ddf

branches/autosynth-iot/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
import java.util.concurrent.ExecutionException;
108108
import java.util.concurrent.Executors;
109109
import java.util.concurrent.Future;
110+
import java.util.concurrent.ScheduledExecutorService;
110111
import javax.annotation.Nullable;
111112
import org.threeten.bp.Duration;
112113

@@ -139,6 +140,8 @@ public class GapicSpannerRpc implements SpannerRpc {
139140
private final Duration checkInterval =
140141
systemProperty(PROPERTY_PERIOD_SECONDS, DEFAULT_PERIOD_SECONDS);
141142

143+
private final ScheduledExecutorService spannerWatchdog;
144+
142145
public static GapicSpannerRpc create(SpannerOptions options) {
143146
return new GapicSpannerRpc(options);
144147
}
@@ -191,14 +194,15 @@ public GapicSpannerRpc(SpannerOptions options) {
191194
CredentialsProvider credentialsProvider =
192195
GrpcTransportOptions.setUpCredentialsProvider(options);
193196

197+
spannerWatchdog =
198+
Executors.newSingleThreadScheduledExecutor(
199+
new ThreadFactoryBuilder()
200+
.setDaemon(true)
201+
.setNameFormat("Cloud-Spanner-WatchdogProvider-%d")
202+
.build());
194203
WatchdogProvider watchdogProvider =
195204
InstantiatingWatchdogProvider.create()
196-
.withExecutor(
197-
Executors.newSingleThreadScheduledExecutor(
198-
new ThreadFactoryBuilder()
199-
.setDaemon(true)
200-
.setNameFormat("Cloud-Spanner-WatchdogProvider-%d")
201-
.build()))
205+
.withExecutor(spannerWatchdog)
202206
.withCheckInterval(checkInterval)
203207
.withClock(NanoClock.getDefaultClock());
204208

@@ -572,6 +576,7 @@ public void shutdown() {
572576
this.spannerStub.close();
573577
this.instanceAdminStub.close();
574578
this.databaseAdminStub.close();
579+
this.spannerWatchdog.shutdown();
575580
}
576581

577582
/**

0 commit comments

Comments
 (0)