File tree Expand file tree Collapse file tree
branches/autosynth-spanner/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 @@ -137,7 +137,7 @@ refs/heads/autosynth-language: e73905aa7672afa47240e65b25c087207f4594f9
137137refs/heads/autosynth-os-login: 123ba209c5769d0ee067e0ce5848bec13b42a4f4
138138refs/heads/autosynth-redis: 6bedce4d7c7c6ca6a22e83ad1780e08fdc565a9e
139139refs/heads/autosynth-scheduler: 57f9fdb1e7de30c85f4ec7198931a07f50603e55
140- refs/heads/autosynth-spanner: 909d0944c96347814c3ec56cb36fbd0c14f700a1
140+ refs/heads/autosynth-spanner: 8894854f9bcd487769ad9f38ce441a88577a4cf3
141141refs/heads/autosynth-speech: 64692f6db11364f663921be02c08072b966b6e7b
142142refs/heads/autosynth-tasks: eb03eeab747e925175890db923945384d89b273a
143143refs/heads/autosynth-texttospeech: 2c442fe0b7f089fbab266edfe4dd83c532e82dd0
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