<div dir="ltr">Thanks for the feedback.<div><br></div><div>So in that case to try to appease both worlds: interrupting tasks and using CompletableFuture, I will just document the DistributedExecutorService to say that the mayInterruptIfRunning argument is only used on the returned future instance from methods such as submit and it is ignored on any chained CompletableFutures.</div><div><br></div><div> - Will<br><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 30, 2016 at 1:37 PM Gustavo Fernandes <<a href="mailto:gustavo@infinispan.org">gustavo@infinispan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 30, 2016 at 6:26 PM, Sanne Grinovero <span dir="ltr"><<a href="mailto:sanne@infinispan.org" target="_blank">sanne@infinispan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On 30 March 2016 at 17:40, William Burns <<a href="mailto:mudokonman@gmail.com" target="_blank">mudokonman@gmail.com</a>> wrote:<br>
> You can still attempt to cancel a task. This email is specifically about<br>
> interruption though. Let me explain the nuances in a bit more detail.<br>
><br>
> With the suggestion we would still fully support if the task hasn't yet<br>
> started that it would be cancellable.<br>
><br>
> However when you cancel a task, there is an mayInterruptIfRunning boolean.<br>
> If mayInterruptIfRunning is true and the task is already running it will try<br>
> to interrupt the thread processing it. This is what this email trail is<br>
> about. We all know that java interruption can be flaky to begin with and<br>
> then adding a remote aspect to it, it becomes even more unreliable.<br>
><br>
> So do you guys think we need to support "interrupting" a task in progress?<br>
<br>
</span>Yes, absolutely! Resources are precious :)<br>
<br>
See also the reasoning of our old friend:<br>
- <a href="https://corner.squareup.com/2016/01/query-sniper.html" rel="noreferrer" target="_blank">https://corner.squareup.com/2016/01/query-sniper.html</a><br>
<br>
Take the example of a non-correctly tuned Hibernate Search "rebuild<br>
all indexes" task. On a non-trivial data set it might need to run for<br>
weeks... you need a way to kill it.<br></blockquote><div><br><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>That's the case of our Mass Indexer: one of the motivations of making it return a Future was <br></div><div>the possibility of cancelling tasks, capability offered by the Distributed Executor.<br></div><div><br></div><div>Gustavo<br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
Sanne<br>
<div><div><br>
><br>
> - Will<br>
><br>
> On Wed, Mar 30, 2016 at 12:29 PM Tristan Tarrant <<a href="mailto:ttarrant@redhat.com" target="_blank">ttarrant@redhat.com</a>><br>
> wrote:<br>
>><br>
>> I agree with Sanne, we need cancellable tasks.<br>
>><br>
>> Tristan<br>
>><br>
>> On 30/03/2016 18:19, Sanne Grinovero wrote:<br>
>> > The term "Interruption" might have been too specific, but being able<br>
>> > to cancel a task seems essential to me.<br>
>> ><br>
>> > On 30 March 2016 at 17:04, William Burns <<a href="mailto:mudokonman@gmail.com" target="_blank">mudokonman@gmail.com</a>> wrote:<br>
>> >> Recently we have been moving a lot of our methods that return Future<br>
>> >> [1] to<br>
>> >> CompletableFuture [2]. Unfortunately the latter, CompletableFuture,<br>
>> >> doesn't<br>
>> >> allow for cancellation of the future, since there is no thread tied to<br>
>> >> it.<br>
>> >> So I am proposing that our DistributedExecutorService [3] no longer<br>
>> >> allows<br>
>> >> for interruption of remote threads on a cancellation. This way we can<br>
>> >> have<br>
>> >> our distributed executor service return CompletableFuture instances<br>
>> >> which do<br>
>> >> not support interruption.<br>
>> >><br>
>> >> Also to note that DistributedExecutorService extends ExecutorService<br>
>> >> which<br>
>> >> returns a normal Future which is documented as allowing cancellation.<br>
>> >> In<br>
>> >> this case I would just document on DistributedExecutorService that we<br>
>> >> don't<br>
>> >> support interruption anyways.<br>
>> >><br>
>> >> Does anyone require the use of interruptable tasks with Distributed<br>
>> >> Executor?<br>
>> >><br>
>> >> Thanks,<br>
>> >><br>
>> >> - Will<br>
>> >><br>
>> >> [1]<br>
>> >><br>
>> >> <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html" rel="noreferrer" target="_blank">https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html</a><br>
>> >> [2]<br>
>> >><br>
>> >> <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html" rel="noreferrer" target="_blank">https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html</a><br>
>> >> [3]<br>
>> >><br>
>> >> <a href="https://docs.jboss.org/infinispan/8.1/apidocs/org/infinispan/distexec/DistributedExecutorService.html" rel="noreferrer" target="_blank">https://docs.jboss.org/infinispan/8.1/apidocs/org/infinispan/distexec/DistributedExecutorService.html</a><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> infinispan-dev mailing list<br>
>> >> <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
>> >> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
>> > _______________________________________________<br>
>> > infinispan-dev mailing list<br>
>> > <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
>> > <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
>> ><br>
>><br>
>> --<br>
>> Tristan Tarrant<br>
>> Infinispan Lead<br>
>> JBoss, a division of Red Hat<br>
>> _______________________________________________<br>
>> infinispan-dev mailing list<br>
>> <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
><br>
><br>
> _______________________________________________<br>
> infinispan-dev mailing list<br>
> <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</div></div></blockquote></div></div></div>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></blockquote></div></div></div>