<font size=2 face="sans-serif">It would be nice if JavaEE Concurrency
defines @Lock as a CDI interceptor, similar to @Transactional . Since the
JavaEE Concurrency spec is stale as per you and Raze point out, how about
experiment in DeltaSpike? If DeltaSpike provides the support of @Lock,
maybe it can be pushed to JavaEE concurrency as part of EE8 update. If
not, maybe CDI should define an addendum for EE integration. I think we
should seriously think about this. </font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">Many thanks,<br>
Emily<br>
===========================<br>
Emily Jiang<br>
WebSphere Application Server, CDI Development Lead</font>
<br><font size=2 face="sans-serif">&nbsp;<br>
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
Phone: &nbsp;+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">Stephan Knitelius &lt;stephan@knitelius.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Reza Rahman &lt;reza_rahman@lycos.com&gt;,
Martin Kouba &lt;mkouba@redhat.com&gt;, </font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">cdi-dev@lists.jboss.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">25/02/2016 20:26</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]
Concurrency Control</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><font size=3>Hi Martin,</font>
<br>
<br><font size=3>yes this particular issue is about concurrent access control.
You are right in pointing out that the&nbsp;lock should be applied&nbsp;</font>
<br><font size=3>to the whole been and only&nbsp;override-able&nbsp;on
a per method basis (similar to EJB Singleton style locking).&nbsp;</font>
<br>
<br><font size=3>Regarding conversation context, its fair enough to point-out
that weld allows for configure the conversation lock timeout.</font>
<br><font size=3>However this is only true for Weld, this should really
be made part of the specification.</font>
<br>
<br><font size=3>Even if we were to specify a standard way to configure
conversation locked timeouts in the CDI specification, it would</font>
<br><font size=3>still make the conversation scope the odd one out of the
lot. Hence it would be more sensible to design a&nbsp;</font>
<br><font size=3>common way to handle concurrent access.</font>
<br>
<br><font size=3>Also I would argue that you cannot implement a common
concurrent access control via interceptors,&nbsp;</font>
<br><font size=3>since the container will preempt any interceptor based
attempt for conversation scoped beans.</font>
<br>
<br><font size=3>As Reza pointed out Oracle has no intend to reopen &quot;Concurrency
Utilities for Java EE&quot; at this time and is not</font>
<br><font size=3>willing to hand it over to anyone else. The same seems
to be true for JTA.</font>
<br>
<br><font size=3>Stephan</font>
<br>
<br>
<br>
<br><font size=3>&nbsp;</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br><font size=3>&nbsp;</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><font size=3>On Thu, 25 Feb 2016 at 15:50 Reza Rahman &lt;</font><a href=mailto:reza_rahman@lycos.com><font size=3 color=blue><u>reza_rahman@lycos.com</u></font></a><font size=3>&gt;
wrote:</font>
<br><font size=3>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'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;</font><a href=mailto:mkouba@redhat.com target=_blank><font size=3 color=blue><u>mkouba@redhat.com</u></font></a><font size=3>&gt;
wrote:<br>
&gt;<br>
&gt; Hi Stephan,<br>
&gt;<br>
&gt; I like the idea of CDI interceptor solution you'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'm not so sure it'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't add concurrency control to the spec provided<br>
&gt; it'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; </font><a href="http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/" target=_blank><font size=3 color=blue><u>http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/</u></font></a><font size=3><br>
&gt;<br>
&gt; [2]<br>
&gt; </font><a href="https://issues.jboss.org/browse/WELD-2113" target=_blank><font size=3 color=blue><u>https://issues.jboss.org/browse/WELD-2113</u></font></a><font size=3><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;</font><a href=mailto:Reza.Rahman@oracle.com target=_blank><font size=3 color=blue><u>Reza.Rahman@oracle.com</u></font></a><font size=3><br>
&gt;&gt; &lt;mailto:</font><a href=mailto:Reza.Rahman@oracle.com target=_blank><font size=3 color=blue><u>Reza.Rahman@oracle.com</u></font></a><font size=3>&gt;&gt;
wrote:<br>
&gt;&gt;<br>
&gt;&gt;&nbsp; &nbsp; We've discussed this issue before. I definitely still
think @Lock<br>
&gt;&gt;&nbsp; &nbsp; belongs in a modular CDI specification. It would
be highly useful to<br>
&gt;&gt;&nbsp; &nbsp; both @Singleton and @ApplicationScoped. Today if
I need to use<br>
&gt;&gt;&nbsp; &nbsp; declarative concurrency control for a shared component
I am<br>
&gt;&gt;&nbsp; &nbsp; essentially forced to use EJB singleton - which shouldn't
be the<br>
&gt;&gt;&nbsp; &nbsp; case and perhaps should not have been the case past
Java EE 6.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; On 2/19/2016 5:27 AM, Stephan Knitelius wrote:<br>
&gt;&gt;&gt;&nbsp; &nbsp; Hi all,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; CDI spec does not define a common concurrency
control mechanism.<br>
&gt;&gt;&gt;&nbsp; &nbsp; The time any type of concurrency control is mentioned
is in<br>
&gt;&gt;&gt;&nbsp; &nbsp; conjunction with EJB and a rather restrictive
one for conversation<br>
&gt;&gt;&gt;&nbsp; &nbsp; context.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; CDI Spec:<br>
&gt;&gt;&gt;&nbsp; &nbsp; The container ensures that a long-running conversation
may be<br>
&gt;&gt;&gt;&nbsp; &nbsp; associated with at most one request at a time,
by blocking or<br>
&gt;&gt;&gt;&nbsp; &nbsp; rejecting concurrent requests. If the container
rejects a request,<br>
&gt;&gt;&gt;&nbsp; &nbsp; it must associate the request with a new transient
conversation<br>
&gt;&gt;&gt;&nbsp; &nbsp; and throw an exception of<br>
&gt;&gt;&gt;&nbsp; &nbsp; type|javax.enterprise.context.BusyConversationException|.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; It would be helpful if a common configurable
concurrency mechanism<br>
&gt;&gt;&gt;&nbsp; &nbsp; (EJB Singleton style locking?) could be established
for all normal<br>
&gt;&gt;&gt;&nbsp; &nbsp; scopes.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; What are your thoughts on this?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; Regards,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; 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;&nbsp; &nbsp; ______________________________________<br>
&gt;&gt;&gt;&nbsp; &nbsp; *Stephan Knitelius*<br>
&gt;&gt;&gt;&nbsp; &nbsp; Alteburger Str. 274<br>
&gt;&gt;&gt;&nbsp; &nbsp; 50968 Köln / Cologne<br>
&gt;&gt;&gt;&nbsp; &nbsp; Deutschland / Germany<br>
&gt;&gt;&gt;&nbsp; &nbsp; </font><a href=mailto:stephan@knitelius.com target=_blank><font size=3 color=blue><u>stephan@knitelius.com</u></font></a><font size=3>
&lt;mailto:</font><a href=mailto:stephan@knitelius.com target=_blank><font size=3 color=blue><u>stephan@knitelius.com</u></font></a><font size=3>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; _______________________________________________<br>
&gt;&gt;&gt;&nbsp; &nbsp; cdi-dev mailing list<br>
&gt;&gt;&gt;&nbsp; &nbsp; </font><a href="mailto:cdi-dev@lists.jboss.org" target=_blank><font size=3 color=blue><u>cdi-dev@lists.jboss.org</u></font></a><font size=3>
&lt;mailto:</font><a href="mailto:cdi-dev@lists.jboss.org" target=_blank><font size=3 color=blue><u>cdi-dev@lists.jboss.org</u></font></a><font size=3>&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; </font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target=_blank><font size=3 color=blue><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size=3><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&nbsp; &nbsp; Note that for all code provided on this list,
the provider licenses the code under the Apache License, Version 2 (</font><a href="http://www.apache.org/licenses/LICENSE-2.0.html" target=_blank><font size=3 color=blue><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size=3>).
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;&nbsp; &nbsp; _______________________________________________<br>
&gt;&gt;&nbsp; &nbsp; cdi-dev mailing list<br>
&gt;&gt;&nbsp; &nbsp; </font><a href="mailto:cdi-dev@lists.jboss.org" target=_blank><font size=3 color=blue><u>cdi-dev@lists.jboss.org</u></font></a><font size=3>
&lt;mailto:</font><a href="mailto:cdi-dev@lists.jboss.org" target=_blank><font size=3 color=blue><u>cdi-dev@lists.jboss.org</u></font></a><font size=3>&gt;<br>
&gt;&gt;&nbsp; &nbsp; </font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target=_blank><font size=3 color=blue><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size=3><br>
&gt;&gt;<br>
&gt;&gt;&nbsp; &nbsp; Note that for all code provided on this list, the
provider licenses<br>
&gt;&gt;&nbsp; &nbsp; the code under the Apache License, Version 2<br>
&gt;&gt;&nbsp; &nbsp; (</font><a href="http://www.apache.org/licenses/LICENSE-2.0.html" target=_blank><font size=3 color=blue><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size=3>).
For all other<br>
&gt;&gt;&nbsp; &nbsp; ideas provided on this list, the provider waives
all patent and<br>
&gt;&gt;&nbsp; &nbsp; 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; </font><a href="mailto:cdi-dev@lists.jboss.org" target=_blank><font size=3 color=blue><u>cdi-dev@lists.jboss.org</u></font></a><font size=3><br>
&gt;&gt; </font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target=_blank><font size=3 color=blue><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size=3><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><a href="http://www.apache.org/licenses/LICENSE-2.0.html" target=_blank><font size=3 color=blue><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size=3>).
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; </font><a href="mailto:cdi-dev@lists.jboss.org" target=_blank><font size=3 color=blue><u>cdi-dev@lists.jboss.org</u></font></a><font size=3><br>
&gt; </font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target=_blank><font size=3 color=blue><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size=3><br>
&gt;<br>
&gt; Note that for all code provided on this list, the provider licenses
the code under the Apache License, Version 2 (</font><a href="http://www.apache.org/licenses/LICENSE-2.0.html" target=_blank><font size=3 color=blue><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size=3>).
For all other ideas provided on this list, the provider waives all patent
and other intellectual property rights inherent in such information.</font><tt><font size=2>_______________________________________________<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.</font></tt>
<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>