File tree Expand file tree Collapse file tree
branches/autosynth-trace/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 @@ -141,7 +141,7 @@ refs/heads/autosynth-spanner: d963fe4368e79cf6abae5d511785e8ced8ac57f4
141141refs/heads/autosynth-speech: c563dcd420cce0a37c39b1b9c24be1b9ba604dc7
142142refs/heads/autosynth-tasks: 25d1eafe8cb66b00e3dad765dac74a5b45b83e63
143143refs/heads/autosynth-texttospeech: 7a3ad430dddaed7a76f2026064502680c9339915
144- refs/heads/autosynth-trace: 909d0944c96347814c3ec56cb36fbd0c14f700a1
144+ refs/heads/autosynth-trace: 8894854f9bcd487769ad9f38ce441a88577a4cf3
145145refs/heads/autosynth-websecurityscanner: fa561b356aabcd92d415ae8dc88fd8d87dbc5b23
146146refs/heads/bigquerystorage: 06db74d123d7f8a3ef48755c2fcabed09faf8e64
147147refs/heads/elharo-patch-1: ce159ef828d3c545991ff78e7b6e0d912a9453e9
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