|
29 | 29 |
|
30 | 30 | import java.io.IOException;
|
31 | 31 | import java.util.concurrent.CompletableFuture;
|
| 32 | +import java.util.concurrent.ExecutorService; |
32 | 33 | import java.util.concurrent.TimeoutException;
|
33 | 34 | import java.util.function.Supplier;
|
34 | 35 |
|
@@ -145,11 +146,11 @@ public AMQCommand exnWrappingRpc(Method m)
|
145 | 146 | }
|
146 | 147 | }
|
147 | 148 |
|
148 |
| - public CompletableFuture<Command> exnWrappingAsyncRpc(Method m) |
| 149 | + public CompletableFuture<Command> exnWrappingAsyncRpc(Method m, ExecutorService executorService) |
149 | 150 | throws IOException
|
150 | 151 | {
|
151 | 152 | try {
|
152 |
| - return privateAsyncRpc(m); |
| 153 | + return privateAsyncRpc(m, executorService); |
153 | 154 | } catch (AlreadyClosedException ace) {
|
154 | 155 | // Do not wrap it since it means that connection/channel
|
155 | 156 | // was closed in some action in the past
|
@@ -204,8 +205,8 @@ public void enqueueRpc(RpcContinuation k)
|
204 | 205 | doEnqueueRpc(() -> new RpcContinuationRpcWrapper(k));
|
205 | 206 | }
|
206 | 207 |
|
207 |
| - public void enqueueAsyncRpc(Method method, CompletableFuture<Command> future) { |
208 |
| - doEnqueueRpc(() -> new CompletableFutureRpcWrapper(method, future)); |
| 208 | + public void enqueueAsyncRpc(Method method, CompletableFuture<Command> future, ExecutorService executorService) { |
| 209 | + doEnqueueRpc(() -> new CompletableFutureRpcWrapper(method, future, executorService)); |
209 | 210 | }
|
210 | 211 |
|
211 | 212 | private void doEnqueueRpc(Supplier<RpcWrapper> rpcWrapperSupplier) {
|
@@ -308,11 +309,11 @@ protected ChannelContinuationTimeoutException wrapTimeoutException(final Method
|
308 | 309 | return new ChannelContinuationTimeoutException(e, this, this._channelNumber, m);
|
309 | 310 | }
|
310 | 311 |
|
311 |
| - private CompletableFuture<Command> privateAsyncRpc(Method m) |
| 312 | + private CompletableFuture<Command> privateAsyncRpc(Method m, ExecutorService executorService) |
312 | 313 | throws IOException, ShutdownSignalException
|
313 | 314 | {
|
314 | 315 | CompletableFuture<Command> future = new CompletableFuture<>();
|
315 |
| - asyncRpc(m, future); |
| 316 | + asyncRpc(m, future, executorService); |
316 | 317 | return future;
|
317 | 318 | }
|
318 | 319 |
|
@@ -347,20 +348,20 @@ public void quiescingRpc(Method m, RpcContinuation k)
|
347 | 348 | }
|
348 | 349 | }
|
349 | 350 |
|
350 |
| - public void asyncRpc(Method m, CompletableFuture<Command> future) |
| 351 | + public void asyncRpc(Method m, CompletableFuture<Command> future, ExecutorService executorService) |
351 | 352 | throws IOException
|
352 | 353 | {
|
353 | 354 | synchronized (_channelMutex) {
|
354 | 355 | ensureIsOpen();
|
355 |
| - quiescingAsyncRpc(m, future); |
| 356 | + quiescingAsyncRpc(m, future, executorService); |
356 | 357 | }
|
357 | 358 | }
|
358 | 359 |
|
359 |
| - public void quiescingAsyncRpc(Method m, CompletableFuture<Command> future) |
| 360 | + public void quiescingAsyncRpc(Method m, CompletableFuture<Command> future, ExecutorService executorService) |
360 | 361 | throws IOException
|
361 | 362 | {
|
362 | 363 | synchronized (_channelMutex) {
|
363 |
| - enqueueAsyncRpc(m, future); |
| 364 | + enqueueAsyncRpc(m, future, executorService); |
364 | 365 | quiescingTransmit(m);
|
365 | 366 | }
|
366 | 367 | }
|
|
0 commit comments