Skip to content

Commit 298706d

Browse files
javabrownsduskis
authored andcommitted
---
yaml --- r: 16183 b: refs/heads/autosynth-firestore c: e9ea3d9 h: refs/heads/master i: 16181: 9871079 16179: 248d3c2 16175: 60f5ed5
1 parent e06d20d commit 298706d

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

  • branches/autosynth-firestore/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
@@ -132,7 +132,7 @@ refs/heads/autosynth-containeranalysis: 039ca5b8db725c76c16a965ff26b2774322b8ef8
132132
refs/heads/autosynth-datastore: 9acd400b484d6691a080c9152a331d88d24fefc1
133133
refs/heads/autosynth-dialogflow: d7477419376eac9b6dcc7dbcede581152527351d
134134
refs/heads/autosynth-errorreporting: 9891e73a56af7c097829ca7a521b0e862ba6af30
135-
refs/heads/autosynth-firestore: 36fbd97799e222fac888ca5e643beb37d6700c77
135+
refs/heads/autosynth-firestore: e9ea3d9bacf0410ef578a9d5c2d25fcbe5955a0d
136136
refs/heads/autosynth-iot: 9d732be07d99843d8cb53d34ec0837328a807fce
137137
refs/heads/autosynth-kms: dcc6e15d68759010c8735cc868135bd7e6c1cc5f
138138
refs/heads/autosynth-language: 8972866b016473559702424205ce5569de47b34d

branches/autosynth-firestore/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)