Answer inlineLe mar. 8 mars 2016 à 03:15, Reza Rahman <reza_rahman@lycos.com> a écrit :I have forwarded this issue to the Java EE platform EG for review. My inclination now is to simply leave this alone with a final earnest request to kindly think carefully about this before finalizing and getting this into the real world. Please keep in mind that the average developer is not that skilled and looks to resources on the web routinely for answers. All those resources are going to immediately point to CompletableFuture, not some obscure superclass.CS is not an obscure superclass it's an interface and all methods in CF returns it, so it's impossible to learn CF and ignore CS existence.Concurrency is not an easy feature to use, people that think they can cut and paste code from stack overflow without digging in the doc will hit a wall very soon.We decided to return a CS to allow advanced user to use it to build async pipeline from here. I guess that the majority of beginners will ignore this returned object (as they would have do it if it had been a CF).All I am trying to do is help design an API that is not going to immediately become difficult for the average end developer to understand and use. It's rather unfortunate that I am already feeling fed up in that simple effort to provide feedback.Reza, feedback is always welcome. But if you don't do it in time you should expect some resistance from the EG who worked a long time (and in an open way) to take these decision. So you need more arguments than "user don't know CS" to make us switch from an interface to an impl, that is not suited for Java EE.Feedback on possible technical issues are welcome.Anyway I am now basically done with this. Unfortunately I have far more urgent matters for Java EE 7 and Java EE 8 to deal with. If I have time I'll look at some more of the CDI 2 work and provide feedback if I can manage time.Again it's welcome. We are about to discuss a programmatic APi for SE boot. Your input will be precious here._______________________________________________Yes, this can be done with a CompletableFuture that has already been constructed - just take a look at the API.As far as not adding it to CDI, I can see either way. What was the original motivation for adding CompletableFutures?Also, it's a good idea to run this by the platform expert group. I know at least JAX-RS is planning to use CompletableFutures for their client API.2016-03-07 20:35 GMT+01:00 Reza Rahman <reza_rahman@lycos.com>:Talking with a colleague about this he reminded me of an important fact I almost forgot. The CompletableFuture API can actually be used with custom executors. That means users concerned about managed threads in a Java EE environment can use it with existing EE 7 concurrency executors.Basically this means CompletableFutures are already pretty Java EE ready.If this is the main cited reason for using CompletionStage, is it really that valid of an argument to justify yet another custom subclass specific only to CDI instead of what's likely to be far more familiar and expected?Did he mention it is true for *created* comlpetion future which is not the case for async events? But this is a good point to not add anything to CDI: the feature is a one liner *already*.I think this is a very bad idea. It's better not to use either API and wait to sort out how CompletableFuture can be used in EE consistently. Because of backwards compatibility rules, it is better to have no API than a bad API.2016-03-07 9:07 GMT+01:00 Martin Kouba <mkouba@redhat.com>:
Dne 7.3.2016 v 09:03 Romain Manni-Bucau napsal(a):
Le 7 mars 2016 08:35, "Martin Kouba" <mkouba@redhat.com
<mailto:mkouba@redhat.com>> a écrit :
>
> Dne 6.3.2016 v 15:39 Romain Manni-Bucau napsal(a):
>
>> Hi guys,
>>
>> as a user having a ComlpetionStage makes me loose some JDK utilities,
>> can we move back to CompletionFuture?
>>
>> It would allow for instance:
>>
>> // doesn't work with CompletionStage
>> CompletionFuture.allOf(event1.fireAsync(...), event2.fireAsync(...))
>> .then(...)
>
>
> Well, this should work if the underlying CompletionStage impl
supports toCompletableFuture(), i.e. in Weld 3:
>
Yes but it is not natural to convert it IMO = we can do better
> CompletableFuture.allOf(event1.fireAsync(...).toCompletableFuture(),
event2.fireAsync(...).toCompletableFuture())
>
> 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<? super
T, ? extends U>)) and supply a default one provided by the impl.
>
Should use the pool in which the evznt is fired then "then step" is
synchronous is my sample so all is decided at fire time
I don't talk about your particular example - I understand that it's not using async exec (although the "then()" method does not exist).
was supposed to represent the different flavours (thenRun, thenCompose, ...) ;).That said I agree on the state switching the pool is better but with these 2 notes:- 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- 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)
>
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> <http://www.tomitribe.com>
>>
>>
>>
>> _______________________________________________
>> cdi-dev mailing list
>> cdi-dev@lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>>
>> Note that for all code provided on this list, the provider licenses
the code under the Apache License, Version 2
(http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
provided on this list, the provider waives all patent and other
intellectual property rights inherent in such information.
>>
>
> --
> Martin Kouba
> Software Engineer
> Red Hat, Czech Republic
--
Martin Kouba
Software Engineer
Red Hat, Czech Republic
_______________________________________________
cdi-dev mailing list
cdi-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
_______________________________________________
cdi-dev mailing list
cdi-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
cdi-dev mailing list
cdi-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.