<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-03-07 9:07 GMT+01:00 Martin Kouba <span dir="ltr"><<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Dne 7.3.2016 v 09:03 Romain Manni-Bucau napsal(a):<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
Le 7 mars 2016 08:35, "Martin Kouba" <<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a><br></span>
<mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>>> a écrit :<span class=""><br>
><br>
> Dne 6.3.2016 v 15:39 Romain Manni-Bucau napsal(a):<br>
><br>
>> Hi guys,<br>
>><br>
>> as a user having a ComlpetionStage makes me loose some JDK utilities,<br>
>> can we move back to CompletionFuture?<br>
>><br>
>> It would allow for instance:<br>
>><br>
>> // doesn't work with CompletionStage<br>
>> CompletionFuture.allOf(event1.fireAsync(...), event2.fireAsync(...))<br>
>> .then(...)<br>
><br>
><br>
> Well, this should work if the underlying CompletionStage impl<br>
supports toCompletableFuture(), i.e. in Weld 3:<br>
><br>
<br>
Yes but it is not natural to convert it IMO = we can do better<br>
<br>
> CompletableFuture.allOf(event1.fireAsync(...).toCompletableFuture(),<br>
event2.fireAsync(...).toCompletableFuture())<br>
><br>
> AFAIK the default async execution facility of CompletableFuture is<br>
ForkJoinPool.commonPool() which is not a good fit for Java EE. Using the<br>
CompletionStage interface allows us to wrap the async calls without the<br>
specified executor (e.g. CompletionStage.thenApplyAsync(Function<? super<br>
T, ? extends U>)) and supply a default one provided by the impl.<br>
><br>
<br>
Should use the pool in which the evznt is fired then "then step" is<br>
synchronous is my sample so all is decided at fire time<br>
</span></blockquote>
<br>
I don't talk about your particular example - I understand that it's not using async exec (although the "then()" method does not exist).<br>
<br></blockquote><div><br></div><div>was supposed to represent the different flavours (thenRun, thenCompose, ...) ;).</div><div><br></div><div>That said I agree on the state switching the pool is better but with these 2 notes:</div><div><br></div><div>- could be better to hide these poorly designed methods then -> don't use CompletionXXX but a CDI API with a bridge to CompletionX to let the user go back on SE tools</div><div>- we still don't have a *standard* config for the pool(s) underlying CDI features so it sounds as poor as SE solution IMO (at least a core/max/ttl config in beans.xml)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
><br>
>><br>
>> Romain Manni-Bucau<br>
>> @rmannibucau <<a href="https://twitter.com/rmannibucau" rel="noreferrer" target="_blank">https://twitter.com/rmannibucau</a>> | Blog<br>
>> <<a href="http://rmannibucau.wordpress.com" rel="noreferrer" target="_blank">http://rmannibucau.wordpress.com</a>> | Github<br>
>> <<a href="https://github.com/rmannibucau" rel="noreferrer" target="_blank">https://github.com/rmannibucau</a>> | LinkedIn<br>
>> <<a href="https://www.linkedin.com/in/rmannibucau" rel="noreferrer" target="_blank">https://www.linkedin.com/in/rmannibucau</a>> | Tomitriber<br>
>> <<a href="http://www.tomitribe.com" rel="noreferrer" target="_blank">http://www.tomitribe.com</a>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> cdi-dev mailing list<br></span>
>> <a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a> <mailto:<a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a>><span class=""><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
>><br>
>> Note that for all code provided on this list, the provider licenses<br>
the code under the Apache License, Version 2<br>
(<a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas<br>
provided on this list, the provider waives all patent and other<br>
intellectual property rights inherent in such information.<br>
>><br>
><br>
> --<br>
> Martin Kouba<br>
> Software Engineer<br>
> Red Hat, Czech Republic<br>
<br>
</span></blockquote><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Martin Kouba<br>
Software Engineer<br>
Red Hat, Czech Republic<br>
</div></div></blockquote></div><br></div></div>