<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-03-07 11:17 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
<br>
Dne 7.3.2016 v 11:10 Romain Manni-Bucau napsal(a):<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
<br>
2016-03-07 10:57 GMT+01:00 Martin Kouba <<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a><br></span><span class="">
<mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>>>:<br>
<br>
Dne 7.3.2016 v 09:45 Romain Manni-Bucau napsal(a):<br>
<br>
2016-03-07 9:07 GMT+01:00 Martin Kouba <<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a><br>
<mailto:<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> <mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>>>>:<div><div class="h5"><br>
<br>
<br>
Dne 7.3.2016 v 09:03 Romain Manni-Bucau napsal(a):<br>
<br>
<br>
Le 7 mars 2016 08:35, "Martin Kouba" <<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a><br>
<mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>><br>
<mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a> <mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>>><br>
<mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a> <mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>><br>
<mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a> <mailto:<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>>>>> a écrit :<br>
<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<br>
some JDK<br>
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(...),<br>
event2.fireAsync(...))<br>
>> .then(...)<br>
><br>
><br>
> Well, this should work if the underlying<br>
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<br>
better<br>
<br>
><br>
<br>
CompletableFuture.allOf(event1.fireAsync(...).toCompletableFuture(),<br>
event2.fireAsync(...).toCompletableFuture())<br>
><br>
> AFAIK the default async execution facility of<br>
CompletableFuture is<br>
ForkJoinPool.commonPool() which is not a good fit for<br>
Java EE.<br>
Using the<br>
CompletionStage interface allows us to wrap the async calls<br>
without the<br>
specified executor (e.g.<br>
CompletionStage.thenApplyAsync(Function<? super<br>
T, ? extends U>)) and supply a default one provided by<br>
the impl.<br>
><br>
<br>
Should use the pool in which the evznt is fired then<br>
"then step" is<br>
synchronous is my sample so all is decided at fire time<br>
<br>
<br>
I don't talk about your particular example - I understand<br>
that it's<br>
not using async exec (although the "then()" method does not<br>
exist).<br>
<br>
<br>
was supposed to represent the different flavours (thenRun,<br>
thenCompose,<br>
...) ;).<br>
<br>
That said I agree on the state switching the pool is better but with<br>
these 2 notes:<br>
<br>
- could be better to hide these poorly designed methods then -><br>
don't<br>
use CompletionXXX but a CDI API with a bridge to CompletionX to<br>
let the<br>
user go back on SE tools<br>
<br>
<br>
Yep, this is one of the possible solutions. On the other hand, I<br>
don't think it's poorly designed. CompletionStage defines the<br>
"default asynchronous execution facility" and CDI spec states that<br>
the CompletionStage returned by fireAsync methods is<br>
container-specific. The impl may choose to clarify this "default<br>
asynchronous execution facility", i.e. there's place for innovation...<br>
<br>
- we still don't have a *standard* config for the pool(s)<br>
underlying CDI<br>
features so it sounds as poor as SE solution IMO (at least a<br>
core/max/ttl config in beans.xml)<br>
<br>
<br>
I don't think this should be standardized...<br>
<br>
<br>
Why? Typically if you take @Asynchronous (EJB spec) you have already<br>
this issue and this is often avoided when portability matters for that<br>
particular reason you don't know how you will behave. Or do you think<br>
concurrency-utilities solves it?<br>
</div></div></blockquote>
<br>
No, it doesn't. I think it should remain impl-specific. You know how it will behave - it will be async. And if needed you could tune up the config, depending on the container. If you specify core/max/ttl the container will not be able to optimize.<div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>"it will be async" <- then container is free to have a single thread (would make a js impl possible :)) which would totally break you app which is supposed to be scalable. Also if the config is container dependent you can just not be able to configure it - I know the container would be bad but you don't always choose it. In any case not having a config means the feature is not reliable and depending on the container specific features means you are aside the EE goals of reliability in the time IMHO.</div><div><br></div><div>Also the container opitmizations can have side effects so if not behaving as expected it needs to be spec-ed.</div><div><br></div><div>Threading model is something central when it starts to be used for a bit mroe than fire and forget once a day, ignoring it is killing before the birth the API you can add on top of it IMO.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
<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>
>> <a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a><br>
<mailto:<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><br>
<mailto:<a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a>>><br>
<mailto:<a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a><br>
<mailto:<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><br>
<mailto:<a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a>>>><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<br>
provider<br>
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<br>
all other<br>
ideas<br>
provided on this list, the provider waives all patent<br>
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>
<br>
--<br>
Martin Kouba<br>
Software Engineer<br>
Red Hat, Czech Republic<br>
<br>
<br>
<br>
--<br>
Martin Kouba<br>
Software Engineer<br>
Red Hat, Czech Republic<br>
<br>
<br>
</blockquote>
<br>
-- <br>
Martin Kouba<br>
Software Engineer<br>
Red Hat, Czech Republic<br>
</div></div></blockquote></div><br></div></div>