<div dir="ltr">That&#39;s also my choice:<div>We should provide 2) for advance usage and consistency sake if we go for Session context control later AND we should provide 1) for an easy usage of this feature.</div><div><br></div><div>A well written JavaDoc should prevent confusion between both approach.</div><div><br></div><div>Antoine</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 29, 2016 at 11:46 AM Martin Kouba &lt;<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Dne 29.9.2016 v 11:16 Antoine Sabot-Durand napsal(a):<br>
&gt; Hi all,<br>
&gt;<br>
&gt; Just to sum up what was said during our Tuesday Hangout meeting. For<br>
&gt; those who were present feel free to correct or amend this.<br>
&gt;<br>
&gt; Controlling Request Context is something rather easy (because it&#39;s<br>
&gt; linked to one thread) while Session Context is far less obvious (used<br>
&gt; across multiple threads) so providing a generic solution to deal with<br>
&gt; their control seems quite complicated.<br>
&gt; That&#39;s why we decided to start addressing the Request Context control<br>
&gt; first and if we fell happy with that, continue the work on the Session<br>
&gt; Context.<br>
&gt;<br>
&gt; Public API to control the request context could be design in 2 different<br>
&gt; ways:<br>
&gt; 1) provide an interceptor to activate request context during the<br>
&gt; intercepted method invocation<br>
<br>
This approach is also not always usable in some integration use cases<br>
where the request cannot be simply &quot;wrapped in a single method call&quot;.<br>
<br>
For instance, in Quartz scheduler you can register a job listener with<br>
methods jobToBeExecuted(), jobExecutionVetoed() and jobWasExecuted() -<br>
here the approach 2) would make sense. On the other hand, you could<br>
implement a JobFactory so that Job instances are beans (or at least<br>
instances obtained and injected from an InjectionTarget) and simply<br>
associate interceptor binding for its execute() method.<br>
<br>
&gt; 2) provide a programmatic API accessible thru a bean (like the<br>
&gt; Conversation bean)<br>
&gt;<br>
&gt; First solution is probably the easiest way for end user (to avoid not<br>
&gt; ended context), but if we go for controlling Session Scope we won&#39;t be<br>
&gt; able to provide a simple interceptor for it and will design something<br>
&gt; like solution 2 for it.<br>
&gt;<br>
&gt; So the question is should we go for 1 or 2 or both (with a risk of<br>
&gt; confusion) ?<br>
<br>
I think that both ways are legal and make sense.<br>
<br>
&gt;<br>
&gt; Thanks for your feedback<br>
&gt;<br>
&gt; Antoine<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; cdi-dev mailing list<br>
&gt; <a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;<br>
&gt; 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>
&gt;<br>
</blockquote></div>