<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>I was thinking about that as well. &nbsp;I agree with having both available, and both being able to do an activateIfNotActive() method (whether thats the activate() method or something else)</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> cdi-dev-bounces@lists.jboss.org &lt;cdi-dev-bounces@lists.jboss.org&gt; on behalf of Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;<br>
<b>Sent:</b> Thursday, September 29, 2016 8:48 AM<br>
<b>To:</b> Martin Kouba<br>
<b>Cc:</b> cdi-dev<br>
<b>Subject:</b> Re: [cdi-dev] Recap of Context Management (CDI-30) hangout meeting</font>
<div>&nbsp;</div>
</div>
<div><font size="2" face="sans-serif">My choice is also:</font> <br>
<font size="2" face="sans-serif">provide 2 solutions.</font> <br>
<br>
<font size="2" face="sans-serif">I would expect most user cases can be solved by the solution 1. Only advanced users would use the solution 2.</font>
<br>
<br>
<font size="2" face="sans-serif">Many thanks,<br>
Emily<br>
===========================<br>
Emily Jiang<br>
WebSphere Application Server, CDI Architect, Development Lead</font> <br>
<font size="2" face="sans-serif">&nbsp;<br>
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
Phone: &nbsp;&#43;44 (0)1962 816278 &nbsp;Internal: 246278<br>
<br>
Email: emijiang@uk.ibm.com <br>
Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
</font><br>
<br>
<br>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">From: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size="1" face="sans-serif">Martin Kouba &lt;mkouba@redhat.com&gt;</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">To: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size="1" face="sans-serif">Mark Struberg &lt;struberg@yahoo.de&gt;, Antoine Sabot-Durand &lt;antoine@sabot-durand.net&gt;, cdi-dev &lt;cdi-dev@lists.jboss.org&gt;</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Date: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size="1" face="sans-serif">29/09/2016 12:16</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Subject: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size="1" face="sans-serif">Re: [cdi-dev] Recap of Context Management (CDI-30) hangout meeting</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Sent by: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size="1" face="sans-serif">cdi-dev-bounces@lists.jboss.org</font>
<br>
<hr noshade="">
<br>
<br>
<br>
<tt><font size="2">Dne 29.9.2016 v 12:59 Mark Struberg napsal(a):<br>
&gt; Martins argument with Quartz is a good one.<br>
&gt;<br>
&gt;<br>
&gt; Having 2 different ways to do the same thing might be making things too complicated. You also have to think about what happens if a user or libraries would mix the 2 approaches?<br>
<br>
That's a good point. But I think it should be ok to state that <br>
activate() is no-op if the request context is already active (and the <br>
same for interceptor). I.e. both the interceptor and the <br>
RequestContextControl bean should perform the check described below.<br>
<br>
&gt;<br>
&gt; So my vote is for the programmatic approach.<br>
&gt;<br>
&gt;<br>
&gt; Oh and while we are at it:<br>
&gt; If we introduce some 'RequestContextControl' bean, should it also contain a isActive() method? Otherwise we might get into troubles with nesting such code.<br>
&gt; Of course it is possible by code like<br>
&gt;<br>
&gt;<br>
&gt; try {<br>
&gt; &nbsp; beanManager.getContext(RequestScoped.class);<br>
&gt; &nbsp; // request context is active<br>
&gt; }<br>
&gt;<br>
&gt; catch (ContextNotActiveException cnae) {<br>
&gt; &nbsp; // request context is not active<br>
&gt; &nbsp; // start it etc.<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; But that seems a bit heavyweight, isn't?<br>
&gt;<br>
&gt; LieGrue,<br>
&gt; strub<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Thursday, 29 September 2016, 11:58, Antoine Sabot-Durand &lt;antoine@sabot-durand.net&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; That's also my choice:<br>
&gt;&gt; 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.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; A well written JavaDoc should prevent confusion between both approach.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Antoine<br>
&gt;&gt;<br>
&gt;&gt; On Thu, Sep 29, 2016 at 11:46 AM Martin Kouba &lt;mkouba@redhat.com&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; Dne 29.9.2016 v 11:16 Antoine Sabot-Durand napsal(a):<br>
&gt;&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Just to sum up what was said during our Tuesday Hangout meeting. For<br>
&gt;&gt;&gt;&gt; those who were present feel free to correct or amend this.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Controlling Request Context is something rather easy (because it's<br>
&gt;&gt;&gt;&gt; linked to one thread) while Session Context is far less obvious (used<br>
&gt;&gt;&gt;&gt; across multiple threads) so providing a generic solution to deal with<br>
&gt;&gt;&gt;&gt; their control seems quite complicated.<br>
&gt;&gt;&gt;&gt; That's why we decided to start addressing the Request Context control<br>
&gt;&gt;&gt;&gt; first and if we fell happy with that, continue the work on the Session<br>
&gt;&gt;&gt;&gt; Context.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Public API to control the request context could be design in 2 different<br>
&gt;&gt;&gt;&gt; ways:<br>
&gt;&gt;&gt;&gt; 1) provide an interceptor to activate request context during the<br>
&gt;&gt;&gt;&gt; intercepted method invocation<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This approach is also not always usable in some integration use cases<br>
&gt;&gt;&gt; where the request cannot be simply &quot;wrapped in a single method call&quot;.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; For instance, in Quartz scheduler you can register a job listener with<br>
&gt;&gt;&gt; methods jobToBeExecuted(), jobExecutionVetoed() and jobWasExecuted() -<br>
&gt;&gt;&gt; here the approach 2) would make sense. On the other hand, you could<br>
&gt;&gt;&gt; implement a JobFactory so that Job instances are beans (or at least<br>
&gt;&gt;&gt; instances obtained and injected from an InjectionTarget) and simply<br>
&gt;&gt;&gt; associate interceptor binding for its execute() method.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; 2) provide a programmatic API accessible thru a bean (like the<br>
&gt;&gt;&gt;&gt; Conversation bean)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; First solution is probably the easiest way for end user (to avoid not<br>
&gt;&gt;&gt;&gt; ended context), but if we go for controlling Session Scope we won't be<br>
&gt;&gt;&gt;&gt; able to provide a simple interceptor for it and will design something<br>
&gt;&gt;&gt;&gt; like solution 2 for it.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; So the question is should we go for 1 or 2 or both (with a risk of<br>
&gt;&gt;&gt;&gt; confusion) ?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I think that both ways are legal and make sense.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Thanks for your feedback<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Antoine<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt; cdi-dev mailing list<br>
&gt;&gt;&gt;&gt; cdi-dev@lists.jboss.org<br>
&gt;&gt;&gt;&gt; </font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" id="LPlnk1422" previewremoved="true"><tt><font size="2">https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size="2"><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html" id="LPlnk790857" previewremoved="true"><tt><font size="2">http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size="2">).
 For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; cdi-dev mailing list<br>
&gt;&gt; cdi-dev@lists.jboss.org<br>
&gt;&gt; </font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" id="LPlnk849800" previewremoved="true"><tt><font size="2">https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size="2"><br>
&gt;&gt;<br>
&gt;&gt; Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html" id="LPlnk178042"><tt><font size="2">http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size="2">).
 For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
&gt;&gt;<br>
&gt;&gt;<br>
_______________________________________________<br>
cdi-dev mailing list<br>
cdi-dev@lists.jboss.org<br>
</font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><tt><font size="2">https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size="2"><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><tt><font size="2">http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size="2">).
 For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
<br>
</font></tt>
<div id="LPBorder_GT_14751537145320.4351858406913902" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14751537145300.6724661184849692" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14751537145310.08897223649137986" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14751537145310.8765537525607652"></div>
<div id="LPTitle_14751537145310.03616240769027401" style="top: 0px; color: rgb(227, 30, 37); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, &quot;Segoe UI Light&quot;, &quot;Segoe WP Light&quot;, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14751537145310.0632529278521865" href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank" style="text-decoration: none;">cdi-dev Info Page - JBoss Developer</a></div>
<div id="LPMetadata_14751537145310.4944622970754122" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
lists.jboss.org</div>
<div id="LPDescription_14751537145310.6502005783859188" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
List to discuss the development of CDI (the specification) To see the collection of prior postings to the list, visit the cdi-dev Archives.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<div id="LPBorder_GT_14751537144810.296675175980589" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14751537144790.35472304827700296" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14751537144800.6173893480242132" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_14751537144800.2826911447119642"></div>
<div id="LPTitle_14751537144800.36454161446397904" style="top: 0px; color: rgb(227, 30, 37); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, &quot;Segoe UI Light&quot;, &quot;Segoe WP Light&quot;, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14751537144800.788987137060059" href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank" style="text-decoration: none;">Apache License, Version 2.0</a></div>
<div id="LPMetadata_14751537144810.5119265148050354" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
www.apache.org</div>
<div id="LPDescription_14751537144810.5371806860350015" style="display: block; color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION. 1. Definitions.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<font size="2" face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number 741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU<br>
</font></div>
</div>
</div>
<hr>
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this
 message, and destroy all physical and electronic copies. Thank you.
</body>
</html>