<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><div class="gmail_quote">2016-03-06 20:25 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>Let&#39;s see. I suspect the specification text for EE concurrency is generic enough for implementations to also be able to cover CDI scopes or any other Java EE API context propagation needs. This means the issue needs to be solved at the individual implementation level. Changing anything in the spec is probably just unnecessary ceremony in this case.</div><div><div class="h5"><div><br></div></div></div></div></blockquote><div><br></div><div>Then 1. concurrency- utility can&#39;t be reliable for &quot;EE&quot; users, 2. CDI still prevent it to work since it would violate the spec to propagate it while request scope is bound to another thread (<a href="http://docs.jboss.org/cdi/spec/1.1/cdi-spec.html#request_context">http://docs.jboss.org/cdi/spec/1.1/cdi-spec.html#request_context</a> handles async listener but not the main AsyncContext part).</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 dir="auto"><div><div class="h5"><div>On Mar 6, 2016, at 2:15 PM, 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"><div class="gmail_extra"><div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div></div></div></div></div></div><div class="gmail_quote">2016-03-06 19:42 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>This frankly surprises me. I&#39;ll check the specification text. This might indeed just be an implementation bug. The EE concurrency utilities are supposed to be copying all relevant context. If this is an issue than it has to be that it is not copying enough of the HTTP request context for CDI to work.</div><div><br></div></div></blockquote><div><br></div><div>The issue is not technical since I got it working but needed to reverse. From my understanding ee concurrency utilities was done in a time CDI was not there so it just ignored it somehow and it hasnt been updated when integrated to the spec. Now with the wording of the CDI - and TCK - it is impossible to make it working since request scope is bound the thre request thread - and not the request. Side note: same applies to session scope and conversation.</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 dir="auto"><div></div><div>Surely the Red Hat folks can quickly shed some light here since they implement essentially this whole stack?</div><div><div><div><br>On Mar 6, 2016, at 1:30 PM, 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"><div class="gmail_extra"><div class="gmail_quote">2016-03-06 19:20 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>Can you kindly try to make the example a bit simpler? It&#39;s important to make the case for how likely this is supposed to occur in most business applications.</div><div><br></div><div>Also, other than making sure that the executor service is propagating thread local request contexts correctly what other solution are you proposing? Did you check the specification? How sure are you that this isn&#39;t simply an implementation bug?</div><div><br></div><div>As far as I know the executor service is supposed to be preserving all relevant parts of the EE context?</div><div><div><div><br></div></div></div></div></blockquote><div><br></div><div>Not in concurrency-utilities for EE at least. That was the first impl I did then Mark pointed out it was violating CDI spec and request scope definition. There is a kind of contracdiction there cause concurrency-utilities doesn&#39;t integrate with CDI at all but we can also see it the opposite way: CDI doesn&#39;t provide any way to propagate a context in another thread. Both point of view are valid so we need to see where we tackle it.</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 dir="auto"><div><div><div>On Mar 6, 2016, at 12:35 PM, 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">does <a href="https://gist.github.com/rmannibucau/d55fce47b001185dca3e" target="_blank">https://gist.github.com/rmannibucau/d55fce47b001185dca3e</a> help?<div><br></div><div>Idea is to give an API to make:</div><div><br></div><div><table style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:13px;line-height:18.2px"><tbody><tr><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                <span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">void</span> <span style="color:rgb(121,93,163)">complete</span>() {</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:18px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                    <span style="color:rgb(167,29,93)">try</span> {</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:18px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                        asyncContext<span style="color:rgb(167,29,93)">.</span>complete();</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:18px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                    } <span style="color:rgb(167,29,93)">finally</span> {</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:18px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                        auditContext<span style="color:rgb(167,29,93)">.</span>end();</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:18px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                    }</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;line-height:18px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;overflow:visible;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre-wrap">                }
</td></tr></tbody></table></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>working without hacky and almost impossible context pushing (cause of injections nature you are not supposed to know what to push in the context when going async).</div><div><br></div><div><br></div><div><br><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-06 16:40 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>Can you kindly share an annotated code example of the proposed solution so we can all follow and discuss this?</div><div><br>On Mar 6, 2016, at 9:31 AM, Romain Manni-Bucau &lt;<a href="mailto:rmannibucau@gmail.com" target="_blank">rmannibucau@gmail.com</a>&gt; wroteshar:<br><br></div><div><div><blockquote type="cite"><div><div dir="ltr">Hi guys,<div><br></div><div>spoke on concurrency utilities about the ability to inherit a cdi scope. Idea is to follow request scope more than cdi spec allows. First thought it was a concurrency utilities thing but Reza mentionned can be a CDI one so here it is.</div><div><br></div><div>Sample:</div><div>In a servlet i get MyBean which is @RequestScoped, I do some set on it. The i go async (AsyncContext) and trigger a task in another thread. It would be neat - and mandatory in some case by the loose coupling nature of CDI - to get the *same* MyBean *instance* in this thread. With a direct dependency you can easily use message passing pattern - but you loose the loose coupling cause you need to know until which level you unwrap, think t principal case which has 2-3 proxies!. However in practice you have a lot of undirect dependencies, in particular with enterprise concerns (auditing, security...) so you can&#39;t really do it easily/naturally.</div><div><br></div><div>Bonus:</div><div>One very verbose way is to be able to kind of push/pop an existing context in a thread - wrappers doing it on a Runnable/Consumer/Function/... would be neat.</div><div><br></div><div>Question:</div><div>Would CDI handle it in 2.0?</div><div><br></div><div>Side note: this is really about the fact to reuse a &quot;context context&quot; (its current instances map) in another thread the more transparently possible and match the user vision more than a technical question for now.</div><div><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br><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>
</div></div>
</div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>cdi-dev mailing list</span><br><span><a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></span><br><span></span><br><span>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" 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.</span></div></blockquote></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></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></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></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>