<div dir="ltr">Hi Martin,<div><br></div><div><div><span style="line-height:1.5">yes this particular issue is about concurrent access control. You are right in pointing out that the </span><span style="line-height:1.5">lock should be applied </span></div><div><span style="line-height:1.5">to the whole been and only </span>override-able<span style="line-height:1.5"> on a per method basis (similar to EJB Singleton style locking). </span></div></div><div><br></div><div>Regarding conversation context, its fair enough to point-out that weld allows for configure the conversation lock timeout.</div><div>However this is only true for Weld, this should really be made part of the specification.</div><div><br></div><div>Even if we were to specify a standard way to configure conversation locked timeouts in the CDI specification, it would</div><div>still make the conversation scope the odd one out of the lot. Hence it would be more sensible to design a </div><div>common way to handle concurrent access.</div><div><br></div><div>Also I would argue that you cannot implement a common concurrent access control via interceptors, </div><div>s<span style="line-height:1.5">ince the container will preempt any interceptor based attempt for conversation scoped beans.</span></div><div><span style="line-height:1.5"><br></span></div><div>As Reza pointed out Oracle has no intend to reopen &quot;<span style="line-height:1.5">Concurrency Utilities for Java EE&quot; at this time and is not</span></div><div><span style="line-height:1.5">willing to hand it over to anyone else. The same seems to be true for JTA.</span></div><div><span style="line-height:1.5"><br></span></div><div>Stephan</div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5"> </span></div><div><br></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5"><br></span></div><div><br></div><div> </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 25 Feb 2016 at 15:50 Reza Rahman &lt;<a href="mailto:reza_rahman@lycos.com">reza_rahman@lycos.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Oracle has pretty much clearly stated it has absolutely no intention of updating the Java EE Concurrency Utilities specification any time soon. My guess is that it will also never allow anyone else to update it either since it owns that specification. If this is a valuable feature to the community (which I definitely think it is) I strongly suggest taking advantage of the fact that this is a gray area and include it in a modular CDI specification so this feature doesn&#39;t continue to remain locked into EJB for Java EE users that need to more effectively use things like @Stereotype for service composition.<br>
<br>
&gt; On Feb 25, 2016, at 9:13 AM, Martin Kouba &lt;<a href="mailto:mkouba@redhat.com" target="_blank">mkouba@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Stephan,<br>
&gt;<br>
&gt; I like the idea of CDI interceptor solution you&#39;re proposing in your<br>
&gt; blogpost [1]. However, concurrency is a difficult topic. First of all,<br>
&gt; this only solves concurrent access to the bean instance (i.e.<br>
&gt; method-level locking) - the bean state is always up to the user. Also<br>
&gt; I&#39;m not so sure it&#39;s a good idea to only apply @Lock at the method level<br>
&gt; (some methods are guarded some not - AFAIK EJB does not allow this either).<br>
&gt;<br>
&gt; I agree that conversation concurrentAccessTimeout in Weld should be<br>
&gt; configurable. In fact, it should be possible to change this timeout even<br>
&gt; now using Weld API and org.jboss.weld.context.ConversationContext. But<br>
&gt; it should be definitely more straightforward [2].<br>
&gt;<br>
&gt; To sum it up - I wouldn&#39;t add concurrency control to the spec provided<br>
&gt; it&#39;s implementable using interceptors. This is a similar situation as to<br>
&gt; javax.transaction.Transactional and JTA. The best place to specify this<br>
&gt; is IMHO &quot;Concurrency Utilities for Java EE&quot;.<br>
&gt;<br>
&gt; Martin<br>
&gt;<br>
&gt; [1]<br>
&gt; <a href="http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/" rel="noreferrer" target="_blank">http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/</a><br>
&gt;<br>
&gt; [2]<br>
&gt; <a href="https://issues.jboss.org/browse/WELD-2113" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/WELD-2113</a><br>
&gt;<br>
&gt; Dne 24.2.2016 v 20:47 Stephan Knitelius napsal(a):<br>
&gt;&gt; I just want to bring this to everyone attention one more time.<br>
&gt;&gt;<br>
&gt;&gt; The conversation scope concurrency control mechanism seems to be a<br>
&gt;&gt; frequent point of pain in many projects.<br>
&gt;&gt;<br>
&gt;&gt; Especially when working with browser triggered asynchronous requests,<br>
&gt;&gt; you can not rely on client-sided request synchronization.<br>
&gt;&gt; Weld, unlike OWB, grants a 1 second timeout prior to throwing a (the<br>
&gt;&gt; specified) BusyConversationException mitigating the effect a bit.<br>
&gt;&gt;<br>
&gt;&gt; This is a rather strict un-configurable type of CC. Also its<br>
&gt;&gt; completely out of alignment with the other build-in scopes, offering no<br>
&gt;&gt; CC what so ever.<br>
&gt;&gt;<br>
&gt;&gt; In the cases of Session- and Application-Scope, thread handling is left<br>
&gt;&gt; entirely to the developer, even so they are just as vulnerable in AJAX<br>
&gt;&gt; environments.<br>
&gt;&gt;<br>
&gt;&gt; We should really consider introducing a common configurable mechanism,<br>
&gt;&gt; that is aligned across all scopes (obviously accounting for backwards<br>
&gt;&gt; compatibility in the case of conversation scope).<br>
&gt;&gt;<br>
&gt;&gt; Would really appreciate some feedback.<br>
&gt;&gt;<br>
&gt;&gt; Kind regards,<br>
&gt;&gt;<br>
&gt;&gt; Stephan<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Mon, 22 Feb 2016 at 23:10 Reza Rahman &lt;<a href="mailto:Reza.Rahman@oracle.com" target="_blank">Reza.Rahman@oracle.com</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:Reza.Rahman@oracle.com" target="_blank">Reza.Rahman@oracle.com</a>&gt;&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;    We&#39;ve discussed this issue before. I definitely still think @Lock<br>
&gt;&gt;    belongs in a modular CDI specification. It would be highly useful to<br>
&gt;&gt;    both @Singleton and @ApplicationScoped. Today if I need to use<br>
&gt;&gt;    declarative concurrency control for a shared component I am<br>
&gt;&gt;    essentially forced to use EJB singleton - which shouldn&#39;t be the<br>
&gt;&gt;    case and perhaps should not have been the case past Java EE 6.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt;    On 2/19/2016 5:27 AM, Stephan Knitelius wrote:<br>
&gt;&gt;&gt;    Hi all,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    CDI spec does not define a common concurrency control mechanism.<br>
&gt;&gt;&gt;    The time any type of concurrency control is mentioned is in<br>
&gt;&gt;&gt;    conjunction with EJB and a rather restrictive one for conversation<br>
&gt;&gt;&gt;    context.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    CDI Spec:<br>
&gt;&gt;&gt;    The container ensures that a long-running conversation may be<br>
&gt;&gt;&gt;    associated with at most one request at a time, by blocking or<br>
&gt;&gt;&gt;    rejecting concurrent requests. If the container rejects a request,<br>
&gt;&gt;&gt;    it must associate the request with a new transient conversation<br>
&gt;&gt;&gt;    and throw an exception of<br>
&gt;&gt;&gt;    type|javax.enterprise.context.BusyConversationException|.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    It would be helpful if a common configurable concurrency mechanism<br>
&gt;&gt;&gt;    (EJB Singleton style locking?) could be established for all normal<br>
&gt;&gt;&gt;    scopes.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    What are your thoughts on this?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    Regards,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    Stephan<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    ______________________________________<br>
&gt;&gt;&gt;    *Stephan Knitelius*<br>
&gt;&gt;&gt;    Alteburger Str. 274<br>
&gt;&gt;&gt;    50968 Köln / Cologne<br>
&gt;&gt;&gt;    Deutschland / Germany<br>
&gt;&gt;&gt;    <a href="mailto:stephan@knitelius.com" target="_blank">stephan@knitelius.com</a> &lt;mailto:<a href="mailto:stephan@knitelius.com" target="_blank">stephan@knitelius.com</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    _______________________________________________<br>
&gt;&gt;&gt;    cdi-dev mailing list<br>
&gt;&gt;&gt;    <a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a>&gt;<br>
&gt;&gt;&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;&gt;&gt;<br>
&gt;&gt;&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;&gt;<br>
&gt;&gt;    _______________________________________________<br>
&gt;&gt;    cdi-dev mailing list<br>
&gt;&gt;    <a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a>&gt;<br>
&gt;&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;&gt;<br>
&gt;&gt;    Note that for all code provided on this list, the provider licenses<br>
&gt;&gt;    the code under the Apache License, Version 2<br>
&gt;&gt;    (<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<br>
&gt;&gt;    ideas provided on this list, the provider waives all patent and<br>
&gt;&gt;    other intellectual property rights inherent in such information.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; cdi-dev mailing list<br>
&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a><br>
&gt;&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;&gt;<br>
&gt;&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>
&gt; --<br>
&gt; Martin Kouba<br>
&gt; Software Engineer<br>
&gt; Red Hat, Czech Republic<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>
</blockquote></div>