/** * Cancel this forked channel, stopping work as soon as possible. If the channel has not yet been started, this method * * @param mayInterruptIfRunning true if the channel is still being worked on, and the thread on which its being worked on may * be interrupted, or false if the channel should be allowed to finish if it is already in work. */ public void cancel( boolean mayInterruptIfRunning ) { if (this.future == null || this.future.isDone() || this.future.isCancelled()) return; // Mark the composite as cancelled first, so that the next composed request will be marked as // cancelled. this.composite.cancel(); // Now mark the channel as being done ... close(); // Now, mark the channel as being cancelled (do allow interrupting the worker thread) ... this.future.cancel(mayInterruptIfRunning); }
channel.await(); } catch (CancellationException err) { composite.cancel(); } catch (ExecutionException err) { composite.setError(err);