Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: partitionedDml stub was not closed #213

Merged
merged 1 commit into from May 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -191,6 +191,12 @@ private synchronized void shutdown() {
executor.shutdown();
}
}

private void awaitTermination() throws InterruptedException {
for (ScheduledExecutorService executor : executors) {
executor.awaitTermination(10L, TimeUnit.SECONDS);
}
}
}

private static final PathTemplate PROJECT_NAME_TEMPLATE =
Expand Down Expand Up @@ -1230,10 +1236,22 @@ GrpcCallContext newCallContext(@Nullable Map<Option, ?> options, String resource
public void shutdown() {
this.rpcIsClosed = true;
this.spannerStub.close();
this.partitionedDmlStub.close();
this.instanceAdminStub.close();
this.databaseAdminStub.close();
this.spannerWatchdog.shutdown();
this.executorProvider.shutdown();

try {
this.spannerStub.awaitTermination(10L, TimeUnit.SECONDS);
this.partitionedDmlStub.awaitTermination(10L, TimeUnit.SECONDS);
this.instanceAdminStub.awaitTermination(10L, TimeUnit.SECONDS);
this.databaseAdminStub.awaitTermination(10L, TimeUnit.SECONDS);
this.spannerWatchdog.awaitTermination(10L, TimeUnit.SECONDS);
this.executorProvider.awaitTermination();
} catch (InterruptedException e) {
throw SpannerExceptionFactory.propagateInterrupt(e);
}
}

@Override
Expand Down