From 7d507997ffc1f00e3530801ca320ae7a518dbaf9 Mon Sep 17 00:00:00 2001 From: Tianzi Cai Date: Mon, 5 Nov 2018 15:36:27 -0800 Subject: [PATCH] Fix ApiFutures.addCallback() (#3886) ApiFutures.addCallback() now requires a third argument (a non-direct executor). Ref: https://github.com/googleapis/api-common-java/blob/master/src/main/java/com/google/api/core/ApiFutures.java --- .../cloud/examples/pubsub/snippets/PublisherSnippets.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/pubsub/snippets/PublisherSnippets.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/pubsub/snippets/PublisherSnippets.java index 989b7ba96a0f..44104c731c3a 100644 --- a/google-cloud-examples/src/main/java/com/google/cloud/examples/pubsub/snippets/PublisherSnippets.java +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/pubsub/snippets/PublisherSnippets.java @@ -36,6 +36,7 @@ import com.google.pubsub.v1.ProjectTopicName; import com.google.pubsub.v1.PubsubMessage; import java.io.FileInputStream; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.threeten.bp.Duration; @@ -62,7 +63,7 @@ public void onSuccess(String messageId) { public void onFailure(Throwable t) { System.out.println("failed to publish: " + t); } - }); + }, Executors.newSingleThreadExecutor()); return messageIdFuture; }