diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java index d99e098a2..692cb77b4 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpc.java @@ -66,6 +66,7 @@ import java.io.IOException; import java.util.Collections; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; /** * GRPC client implementation of the Firestore RPC methods. Exposes FirestoreOptions on top of the @@ -152,6 +153,9 @@ public void close() throws Exception { for (BackgroundResource resource : clientContext.getBackgroundResources()) { resource.close(); } + for (BackgroundResource resource : clientContext.getBackgroundResources()) { + resource.awaitTermination(1, TimeUnit.SECONDS); + } executorFactory.release(executor); }