<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 &lt;<a href="mailto:gustavo@infinispan.org">gustavo@infinispan.org</a>&gt; 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">&lt;<a href="mailto:sanne@infinispan.org" target="_blank">sanne@infinispan.org</a>&gt;</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 &lt;<a href="mailto:mudokonman@gmail.com" target="_blank">mudokonman@gmail.com</a>&gt; wrote:<br>
&gt; You can still attempt to cancel a task.  This email is specifically about<br>
&gt; interruption though.  Let me explain the nuances in a bit more detail.<br>
&gt;<br>
&gt; With the suggestion we would still fully support if the task hasn&#39;t yet<br>
&gt; started that it would be cancellable.<br>
&gt;<br>
&gt; However when you cancel a task, there is an mayInterruptIfRunning boolean.<br>
&gt; If mayInterruptIfRunning is true and the task is already running it will try<br>
&gt; to interrupt the thread processing it.  This is what this email trail is<br>
&gt; about.  We all know that java interruption can be flaky to begin with and<br>
&gt; then adding a remote aspect to it, it becomes even more unreliable.<br>
&gt;<br>
&gt; So do you guys think we need to support &quot;interrupting&quot; 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 &quot;rebuild<br>
all indexes&quot; 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&#39;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>
&gt;<br>
&gt;  - Will<br>
&gt;<br>
&gt; On Wed, Mar 30, 2016 at 12:29 PM Tristan Tarrant &lt;<a href="mailto:ttarrant@redhat.com" target="_blank">ttarrant@redhat.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I agree with Sanne, we need cancellable  tasks.<br>
&gt;&gt;<br>
&gt;&gt; Tristan<br>
&gt;&gt;<br>
&gt;&gt; On 30/03/2016 18:19, Sanne Grinovero wrote:<br>
&gt;&gt; &gt; The term &quot;Interruption&quot; might have been too specific, but being able<br>
&gt;&gt; &gt; to cancel a task seems essential to me.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On 30 March 2016 at 17:04, William Burns &lt;<a href="mailto:mudokonman@gmail.com" target="_blank">mudokonman@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; Recently we have been moving a lot of our methods that return Future<br>
&gt;&gt; &gt;&gt; [1] to<br>
&gt;&gt; &gt;&gt; CompletableFuture [2].  Unfortunately the latter, CompletableFuture,<br>
&gt;&gt; &gt;&gt; doesn&#39;t<br>
&gt;&gt; &gt;&gt; allow for cancellation of the future, since there is no thread tied to<br>
&gt;&gt; &gt;&gt; it.<br>
&gt;&gt; &gt;&gt; So I am proposing that our DistributedExecutorService [3] no longer<br>
&gt;&gt; &gt;&gt; allows<br>
&gt;&gt; &gt;&gt; for interruption of remote threads on a cancellation.  This way we can<br>
&gt;&gt; &gt;&gt; have<br>
&gt;&gt; &gt;&gt; our distributed executor service return CompletableFuture instances<br>
&gt;&gt; &gt;&gt; which do<br>
&gt;&gt; &gt;&gt; not support interruption.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Also to note that DistributedExecutorService extends ExecutorService<br>
&gt;&gt; &gt;&gt; which<br>
&gt;&gt; &gt;&gt; returns a normal Future which is documented as allowing cancellation.<br>
&gt;&gt; &gt;&gt; In<br>
&gt;&gt; &gt;&gt; this case I would just document on DistributedExecutorService that we<br>
&gt;&gt; &gt;&gt; don&#39;t<br>
&gt;&gt; &gt;&gt; support interruption anyways.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Does anyone require the use of interruptable tasks with Distributed<br>
&gt;&gt; &gt;&gt; Executor?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;   - Will<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; [1]<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; <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>
&gt;&gt; &gt;&gt; [2]<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; <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>
&gt;&gt; &gt;&gt; [3]<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; <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>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; infinispan-dev mailing list<br>
&gt;&gt; &gt;&gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; infinispan-dev mailing list<br>
&gt;&gt; &gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Tristan Tarrant<br>
&gt;&gt; Infinispan Lead<br>
&gt;&gt; JBoss, a division of Red Hat<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; infinispan-dev mailing list<br>
&gt;&gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; infinispan-dev mailing list<br>
&gt; <a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
&gt; <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>