1818
1919import com .google .api .core .AbstractApiService ;
2020import com .google .api .core .ApiClock ;
21+ import com .google .api .core .ApiFutureCallback ;
22+ import com .google .api .core .ApiFutures ;
2123import com .google .api .core .InternalApi ;
24+ import com .google .api .core .SettableApiFuture ;
2225import com .google .api .gax .batching .FlowController ;
2326import com .google .api .gax .core .Distribution ;
2427import com .google .api .gax .grpc .GrpcStatusCode ;
2730import com .google .cloud .pubsub .v1 .MessageDispatcher .AckProcessor ;
2831import com .google .cloud .pubsub .v1 .MessageDispatcher .PendingModifyAckDeadline ;
2932import com .google .common .collect .Lists ;
30- import com .google .common .util .concurrent .FutureCallback ;
31- import com .google .common .util .concurrent .Futures ;
32- import com .google .common .util .concurrent .SettableFuture ;
33+ import com .google .common .util .concurrent .MoreExecutors ;
3334import com .google .protobuf .Empty ;
3435import com .google .pubsub .v1 .AcknowledgeRequest ;
3536import com .google .pubsub .v1 .ModifyAckDeadlineRequest ;
@@ -127,7 +128,7 @@ protected void doStop() {
127128 private class StreamingPullResponseObserver
128129 implements ClientResponseObserver <StreamingPullRequest , StreamingPullResponse > {
129130
130- final SettableFuture <Void > errorFuture ;
131+ final SettableApiFuture <Void > errorFuture ;
131132
132133 /**
133134 * When a batch finsihes processing, we want to request one more batch from the server. But by
@@ -138,7 +139,7 @@ private class StreamingPullResponseObserver
138139 */
139140 ClientCallStreamObserver <StreamingPullRequest > thisRequestObserver ;
140141
141- StreamingPullResponseObserver (SettableFuture <Void > errorFuture ) {
142+ StreamingPullResponseObserver (SettableApiFuture <Void > errorFuture ) {
142143 this .errorFuture = errorFuture ;
143144 }
144145
@@ -186,7 +187,7 @@ public void onCompleted() {
186187 }
187188
188189 private void initialize () {
189- final SettableFuture <Void > errorFuture = SettableFuture .create ();
190+ final SettableApiFuture <Void > errorFuture = SettableApiFuture .create ();
190191 final ClientResponseObserver <StreamingPullRequest , StreamingPullResponse > responseObserver =
191192 new StreamingPullResponseObserver (errorFuture );
192193 final ClientCallStreamObserver <StreamingPullRequest > requestObserver =
@@ -215,9 +216,9 @@ private void initialize() {
215216 lock .unlock ();
216217 }
217218
218- Futures .addCallback (
219+ ApiFutures .addCallback (
219220 errorFuture ,
220- new FutureCallback <Void >() {
221+ new ApiFutureCallback <Void >() {
221222 @ Override
222223 public void onSuccess (@ Nullable Void result ) {
223224 if (!isAlive ()) {
@@ -260,7 +261,8 @@ public void run() {
260261 backoffMillis ,
261262 TimeUnit .MILLISECONDS );
262263 }
263- });
264+ },
265+ MoreExecutors .directExecutor ());
264266 }
265267
266268 private boolean isAlive () {
0 commit comments