<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div></div></div></div></div></div>
<br><div class="gmail_quote">2016-03-08 14:22 GMT+01:00 Reza Rahman <span dir="ltr">&lt;<a href="mailto:reza_rahman@lycos.com" target="_blank">reza_rahman@lycos.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I think the JDK team made the right usability call by including everything into CompletableFuture as a one stop shop. That&#39;s why the API will probably prove more usable in the end.</div><div><br></div></div></blockquote><div><br></div><div>This is also about choosing the right level of exposed API.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div>Can a developer erroneously call complete()? Sure, but it&#39;s pretty unlikely since it just doesn&#39;t fit the client usage pattern for a promise. And they can make this unlikely error either for @Asynchronous, CDI asynchronous events and pretty much just about anywhere CompletableFuture is used as an API.</div><div><br></div></div></blockquote><div><br></div><div>In previous sample I would agree it is a programming error but in a real application you can pass the future through several layers and then it is less obvious (this async event opens a nice and fluent way to trigger an event which is actually your returned data as well: return asyncEvent.fireAsync(myResult);).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div>That said, I&#39;ve also reached out to the JDK team on this. I hope they will have the time to explain their design motivations themselves and clarify what they would expect from EE or just about anyone else needing to use their APIs.</div><div><div class="h5"><div><br></div></div></div></div></blockquote><div><br></div><div>Thanks</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div class="h5"><div>On Mar 8, 2016, at 8:06 AM, Romain Manni-Bucau &lt;<a href="mailto:rmannibucau@gmail.com" target="_blank">rmannibucau@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">@Reza: can you clarify the behavior of this snippet please:<div><br></div><div>CompletionFuture&lt;AnEvent&gt; cf = asyncEvent.fireAsync(...);</div><div>cf.complete(new AnEvent()); // not deterministic even if the container will likely get false calling complete, should it be ignored? throw an exception? other?</div><div><br></div><div>That&#39;s one point where CompletionStage sounds wiser than CompletionFuture for CDI async events. The javadoc makes the goal clear: &quot;<span style="color:rgb(150,152,150);font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre-wrap">@return a {@link CompletionStage} allowing further pipeline composition on the asynchronous operation.</span>&quot;. Using CompletionFuture opens the door to the state manipulation which is not intended (or you have a plan for that?) and which is easily misleading IMHO.<br><div class="gmail_extra"><br></div><div class="gmail_extra">CompletionFuture would however make a lot of sense for some parts of EE and to replace @Asynchronous AsyncResult hack cause there you need to handle the state yourself. Both being compatible I see it as a consistent usage of each API.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><span style="font-size:small">Romain Manni-Bucau</span><br><a href="https://twitter.com/rmannibucau" target="_blank">@rmannibucau</a> |  <a href="http://rmannibucau.wordpress.com" target="_blank">Blog</a> | <a href="https://github.com/rmannibucau" target="_blank">Github</a> | <a href="https://www.linkedin.com/in/rmannibucau" target="_blank">LinkedIn</a> | <a href="http://www.tomitribe.com" target="_blank">Tomitriber</a></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">2016-03-08 13:53 GMT+01:00 Reza Rahman <span dir="ltr">&lt;<a href="mailto:reza_rahman@lycos.com" target="_blank">reza_rahman@lycos.com</a>&gt;</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"><div dir="auto"><div>FYI - more feedback from just another developer that happens to care a great deal about EE.</div><div><br>Begin forwarded message:<br><br></div><blockquote type="cite"><div><b>From:</b> Josh Juneau &lt;<a href="mailto:juneau001@gmail.com" target="_blank">juneau001@gmail.com</a>&gt;<br><b>Date:</b> March 8, 2016 at 7:41:56 AM EST<br><b>To:</b> &quot;<a href="mailto:users@javaee-spec.java.net" target="_blank">users@javaee-spec.java.net</a>&quot; &lt;<a href="mailto:users@javaee-spec.java.net" target="_blank">users@javaee-spec.java.net</a>&gt;<br><b>Subject:</b> <b>[javaee-spec users] Re: CompletableFuture Usage in the Platfom vs CDI</b><br><b>Reply-To:</b> <a href="mailto:users@javaee-spec.java.net" target="_blank">users@javaee-spec.java.net</a><br><br></div></blockquote><div><div><blockquote type="cite"><div><div dir="ltr">Reza-<div><br></div><div>I am in agreement with you.  I agree that CompleteableFuture seems to make more sense for asynchronous events than CompletionStage.  Given that it is widely acceptable throughout the platform, and the naming aligns more closely with asynchronous activity...I think CompleteableFuture would be a more consistent and standardized choice.</div><div><br></div><div>Thanks</div></div><div class="gmail_extra"><br clear="all"><div><div>Josh Juneau<br><a href="mailto:juneau001@gmail.com" target="_blank">juneau001@gmail.com</a><br><a href="http://jj-blogger.blogspot.com" target="_blank">http://jj-blogger.blogspot.com</a><br><a href="https://www.apress.com/index.php/author/author/view/id/1866" target="_blank">https://www.apress.com/index.php/author/author/view/id/1866</a><br><br></div></div>
<br><div class="gmail_quote">On Mon, Mar 7, 2016 at 6:40 PM, Reza Rahman <span dir="ltr">&lt;<a href="mailto:reza_rahman@lycos.com" target="_blank">reza_rahman@lycos.com</a>&gt;</span> wrote:<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">The CDI EG is incorporating the concept of CompletableFuture into asynchronous events. Unfortunately for reasons I really don&#39;t see as good they are using it&#39;s superinterface CompletionStage instead of CompletableFuture.<br>
<br>
I think this is a big ease-of-use mistake as CompletableFuture is designed to be the end user high level gateway API while CompletionStage is mostly as SPI intended for framework writers.<br>
<br>
Given that the CompletableFuture concept is pretty widely applicable throughout the platform I think there is a need for consistency, oversight and guidance from the platform expert group. Otherwise I fear less than ideal ad-hoc decisions might be made in this case for CDI and possibly others down the line.<br>
<br>
What do you think?</blockquote></div><br></div>
</div></blockquote></div></div></div><br>_______________________________________________<br>
cdi-dev mailing list<br>
<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 provider licenses the code under the Apache License, Version 2 (<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 provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br></blockquote></div><br></div></div></div>
</div></blockquote></div></div></div><br>_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">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 provider licenses the code under the Apache License, Version 2 (<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 provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br></blockquote></div><br></div></div>