File tree Expand file tree Collapse file tree
branches/autosynth-redis/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ refs/heads/autosynth-iot: 044be280805a59e06d09658688c9ee474a9815ad
135135refs/heads/autosynth-kms: d31449d6621a50fb16a4bef4f30f0f3051d27d7c
136136refs/heads/autosynth-language: 6130869312f99a1e7d3aa0485759172a23333cc5
137137refs/heads/autosynth-os-login: 49028d40ac477fca5f948cc5a3ce7422729fdb67
138- refs/heads/autosynth-redis: 909d0944c96347814c3ec56cb36fbd0c14f700a1
138+ refs/heads/autosynth-redis: 8894854f9bcd487769ad9f38ce441a88577a4cf3
139139refs/heads/autosynth-scheduler: 57f9fdb1e7de30c85f4ec7198931a07f50603e55
140140refs/heads/autosynth-spanner: de02ca32edea133b68b51052e325359a3704b5d2
141141refs/heads/autosynth-speech: 64692f6db11364f663921be02c08072b966b6e7b
Original file line number Diff line number Diff line change @@ -304,15 +304,18 @@ public void publishAllOutstanding() {
304304 publishOutstandingBatch (batchToSend );
305305 }
306306
307- private void publishOutstandingBatch ( final OutstandingBatch outstandingBatch ) {
307+ private ApiFuture < PublishResponse > publishCall ( OutstandingBatch outstandingBatch ) {
308308 PublishRequest .Builder publishRequest = PublishRequest .newBuilder ();
309309 publishRequest .setTopic (topicName );
310310 for (OutstandingPublish outstandingPublish : outstandingBatch .outstandingPublishes ) {
311311 publishRequest .addMessages (outstandingPublish .message );
312312 }
313313
314- ApiFutures .addCallback (
315- publisherStub .publishCallable ().futureCall (publishRequest .build ()),
314+ return publisherStub .publishCallable ().futureCall (publishRequest .build ());
315+ }
316+
317+ private void publishOutstandingBatch (final OutstandingBatch outstandingBatch ) {
318+ ApiFutureCallback <PublishResponse > futureCallback =
316319 new ApiFutureCallback <PublishResponse >() {
317320 @ Override
318321 public void onSuccess (PublishResponse result ) {
@@ -351,8 +354,9 @@ public void onFailure(Throwable t) {
351354 messagesWaiter .incrementPendingMessages (-outstandingBatch .size ());
352355 }
353356 }
354- },
355- directExecutor ());
357+ };
358+
359+ ApiFutures .addCallback (publishCall (outstandingBatch ), futureCallback , directExecutor ());
356360 }
357361
358362 private static final class OutstandingBatch {
You can’t perform that action at this time.
0 commit comments