<p dir="ltr"><br>
Le 7 mars 2016 08:35, &quot;Martin Kouba&quot; &lt;<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>&gt; a écrit :<br>
&gt;<br>
&gt; Dne 6.3.2016 v 15:39 Romain Manni-Bucau napsal(a):<br>
&gt;<br>
&gt;&gt; Hi guys,<br>
&gt;&gt;<br>
&gt;&gt; as a user having a ComlpetionStage makes me loose some JDK utilities,<br>
&gt;&gt; can we move back to CompletionFuture?<br>
&gt;&gt;<br>
&gt;&gt; It would allow for instance:<br>
&gt;&gt;<br>
&gt;&gt; // doesn&#39;t work with CompletionStage<br>
&gt;&gt; CompletionFuture.allOf(event1.fireAsync(...), event2.fireAsync(...))<br>
&gt;&gt;        .then(...)<br>
&gt;<br>
&gt;<br>
&gt; Well, this should work if the underlying CompletionStage impl supports toCompletableFuture(), i.e. in Weld 3:<br>
&gt;</p>
<p dir="ltr">Yes but it is not natural to convert it IMO = we can do better</p>
<p dir="ltr">&gt; CompletableFuture.allOf(event1.fireAsync(...).toCompletableFuture(), event2.fireAsync(...).toCompletableFuture())<br>
&gt;<br>
&gt; AFAIK the default async execution facility of CompletableFuture is ForkJoinPool.commonPool() which is not a good fit for Java EE. Using the CompletionStage interface allows us to wrap the async calls without the specified executor (e.g. CompletionStage.thenApplyAsync(Function&lt;? super T, ? extends U&gt;)) and supply a default one provided by the impl.<br>
&gt;</p>
<p dir="ltr">Should use the pool in which the evznt is fired then &quot;then step&quot; is synchronous is my sample so all is decided at fire time</p>
<p dir="ltr">&gt;<br>
&gt;&gt;<br>
&gt;&gt; Romain Manni-Bucau<br>
&gt;&gt; @rmannibucau &lt;<a href="https://twitter.com/rmannibucau">https://twitter.com/rmannibucau</a>&gt; | Blog<br>
&gt;&gt; &lt;<a href="http://rmannibucau.wordpress.com">http://rmannibucau.wordpress.com</a>&gt; | Github<br>
&gt;&gt; &lt;<a href="https://github.com/rmannibucau">https://github.com/rmannibucau</a>&gt; | LinkedIn<br>
&gt;&gt; &lt;<a href="https://www.linkedin.com/in/rmannibucau">https://www.linkedin.com/in/rmannibucau</a>&gt; | Tomitriber<br>
&gt;&gt; &lt;<a href="http://www.tomitribe.com">http://www.tomitribe.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; cdi-dev mailing list<br>
&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;&gt;<br>
&gt;&gt; Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
&gt;&gt;<br>
&gt;<br>
&gt; -- <br>
&gt; Martin Kouba<br>
&gt; Software Engineer<br>
&gt; Red Hat, Czech Republic<br>
</p>