Re: [cdi-dev] Concurrency Control
by Werner Keil
Yes, there's no "incubating" stage for JSRs other than "not Final", so as
soon as a JSR or parts of it are final, they become part of an umbrella
spec if that spec wants to contain them.
Potentially from Java EE 9 on there could be much finer grained activation
or deactivation of features and profiles as soon as the whole Jigsaw thing
and SE 9 is out, but until then I think we' have to stick to what's
available right now.
For CDI 2 modularity or running in Java SE are already in scope, but other
than e.g. having "ee-concurrency" only in the Java EE profile of CDI, I
don't see how CDI should do things the platform will provide later anyway.
Regards,
Werner
On Sun, Feb 28, 2016 at 7:59 PM, Reza Rahman <reza_rahman(a)lycos.com> wrote:
> I am unsure what this means. Firstly I think this functionality is way
> overdue. Secondly I see little value to having anything that is a
> pseudo-standard. I'd rather see the effort pursue another path to
> standardization or remain completely independent while clearly pointing out
> what the obstacles to standardization are/were.
>
> On the other hand if this is required to be implemented in Java EE 8
> runtimes I don't think it matters what the particular structural gymnastics
> are. Purely from a JCP standpoint, it is possible to have a
> sub-specification but only if the eventual goal is to spin it out into a
> separate specification. Examples of this are JPA, interceptors and others.
> There is no precedent for an "incubator" specification that is somehow
> optional. In fact I am pretty sure the current JCP rules would disallow
> this.
>
> On Feb 28, 2016, at 1:29 PM, Romain Manni-Bucau <rmannibucau(a)gmail.com>
> wrote:
>
> At apache we have subprojects which can become top level project if they
> behaves well. Would it be possible at EE level? Idea would be to have
> cdi-concurrency subspec (under CDI umbrella but not part of CDI itself -
> know there was appendix in bval for instance). Then for EE 9 if the subspec
> is proven as good it would become its own spec. wdyt?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2016-02-28 19:16 GMT+01:00 Mark Struberg <struberg(a)yahoo.de>:
>
>>
>> > Am 26.02.2016 um 17:39 schrieb Werner Keil <werner.keil(a)gmail.com>:
>> >
>> > Reza/all,
>> >
>> > One of the biggest problems with Concurrency Utilities is, that it
>> started in 2003, then went "dormant" (before the term existed) and was
>> revived to be finalized 10 years later after little or no proper alignment
>> with then state of the art Java EE standards and technologies. It
>> duplicates things, especially in EJB or CDI.
>> >
>>
>> +1 that pretty much sums it up. Concurrency utils is pretty much broken
>> and unusable as it is today. :/
>>
>> Anyway, let’s not fight the past - we need a way forward.
>>
>> LieGrue,
>> strub
>>
>>
>>
>> _______________________________________________
>> cdi-dev mailing list
>> cdi-dev(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>>
>> Note that for all code provided on this list, the provider licenses the
>> code under the Apache License, Version 2 (
>> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
>> provided on this list, the provider waives all patent and other
>> intellectual property rights inherent in such information.
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
>
>
8 years, 9 months
Re: [cdi-dev] Concurrency Control
by Werner Keil
Reza/all,
One of the biggest problems with Concurrency Utilities is, that it started
in 2003, then went "dormant" (before the term existed) and was revived to
be finalized 10 years later after little or no proper alignment with then
state of the art Java EE standards and technologies. It duplicates things,
especially in EJB or CDI.
Similar to the even older JSR 107 which also has similar problems and
technical debt (as members of this and other EGs confirmed or expressed
their concern)
We can't undo many of these problems, but it seems both these "relics" need
at the very least a solid MR if not entirely new JSRs (before EE 8 wraps up
the selected features) to address their age and fit in more nicely into the
recent platform) JMS 2 did a great job in that direction and even has a new
JSR for Java EE 8.
Regards,
Werner
On Fri, Feb 26, 2016 at 12:40 PM, <cdi-dev-request(a)lists.jboss.org> wrote:
> Send cdi-dev mailing list submissions to
> cdi-dev(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> or, via email, send a message with subject or body 'help' to
> cdi-dev-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> cdi-dev-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of cdi-dev digest..."
>
>
> Today's Topics:
>
> 1. Re: Concurrency Control (Reza Rahman)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 26 Feb 2016 06:40:38 -0500
> From: Reza Rahman <reza_rahman(a)lycos.com>
> Subject: Re: [cdi-dev] Concurrency Control
> To: Emily Jiang <EMIJIANG(a)uk.ibm.com>
> Cc: cdi-dev(a)lists.jboss.org
> Message-ID: <7313A4E6-24FA-4427-964A-BADF7FBE4FB8(a)lycos.com>
> Content-Type: text/plain; charset="utf-8"
>
> No objections whatsoever. I will put in the JIRAs ASAP so we can give this
> the attention it deserves.
>
> > On Feb 26, 2016, at 4:32 AM, Emily Jiang <EMIJIANG(a)uk.ibm.com> wrote:
> >
> > Hi Reza,
> >
> > I understand your frustration. I would suggest you raising a CDI jira to
> get all options discussed. Any objections?
> >
> > Many thanks,
> > Emily
> > ===========================
> > Emily Jiang
> > WebSphere Application Server, CDI Development Lead
> >
> > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> > Phone: +44 (0)1962 816278 Internal: 246278
> >
> > Email: emijiang(a)uk.ibm.com
> > Lotus Notes: Emily Jiang/UK/IBM@IBMGB
> >
> >
> >
> >
> > From: Reza Rahman <reza_rahman(a)lycos.com>
> > To: Emily Jiang/UK/IBM@IBMGB,
> > Cc: cdi-dev(a)lists.jboss.org
> > Date: 25/02/2016 23:01
> > Subject: Re: [cdi-dev] Concurrency Control
> > Sent by: cdi-dev-bounces(a)lists.jboss.org
> >
> >
> >
> > This is not just a problem with this one feature but a much broader one
> involving @Asynchronous, @Schedule and many others. Simply punting on this
> problem and not dealing with this class of problems vigorously is rather
> foolish. It winds up doing what it has done for years - undermining pretty
> much all efforts related to Java EE, especially compared to the velocity
> and effectiveness by which the clear competitors to everything Java EE
> solve these issues. In the end, we are collectively to blame for the dismal
> state of affairs in Java EE land because of this sort of thing.
> >
> > On Feb 25, 2016, at 4:18 PM, Emily Jiang <EMIJIANG(a)uk.ibm.com> wrote:
> >
> > 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.
> >
> >
> >
> > Many thanks,
> > Emily
> > ===========================
> > Emily Jiang
> > WebSphere Application Server, CDI Development Lead
> >
> > MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> > Phone: +44 (0)1962 816278 Internal: 246278
> >
> > Email: emijiang(a)uk.ibm.com
> > Lotus Notes: Emily Jiang/UK/IBM@IBMGB
> >
> >
> >
> >
> > From: Stephan Knitelius <stephan(a)knitelius.com>
> > To: Reza Rahman <reza_rahman(a)lycos.com>, Martin Kouba <
> mkouba(a)redhat.com>,
> > Cc: cdi-dev(a)lists.jboss.org
> > Date: 25/02/2016 20:26
> > Subject: Re: [cdi-dev] Concurrency Control
> > Sent by: cdi-dev-bounces(a)lists.jboss.org
> >
> >
> >
> > Hi Martin,
> >
> > yes this particular issue is about concurrent access control. You are
> right in pointing out that the lock should be applied
> > to the whole been and only override-able on a per method basis (similar
> to EJB Singleton style locking).
> >
> > Regarding conversation context, its fair enough to point-out that weld
> allows for configure the conversation lock timeout.
> > However this is only true for Weld, this should really be made part of
> the specification.
> >
> > Even if we were to specify a standard way to configure conversation
> locked timeouts in the CDI specification, it would
> > still make the conversation scope the odd one out of the lot. Hence it
> would be more sensible to design a
> > common way to handle concurrent access.
> >
> > Also I would argue that you cannot implement a common concurrent access
> control via interceptors,
> > since the container will preempt any interceptor based attempt for
> conversation scoped beans.
> >
> > As Reza pointed out Oracle has no intend to reopen "Concurrency
> Utilities for Java EE" at this time and is not
> > willing to hand it over to anyone else. The same seems to be true for
> JTA.
> >
> > Stephan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Thu, 25 Feb 2016 at 15:50 Reza Rahman <reza_rahman(a)lycos.com> wrote:
> > 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.
> >
> > > On Feb 25, 2016, at 9:13 AM, Martin Kouba <mkouba(a)redhat.com> wrote:
> > >
> > > Hi Stephan,
> > >
> > > I like the idea of CDI interceptor solution you're proposing in your
> > > blogpost [1]. However, concurrency is a difficult topic. First of all,
> > > this only solves concurrent access to the bean instance (i.e.
> > > method-level locking) - the bean state is always up to the user. Also
> > > I'm not so sure it's a good idea to only apply @Lock at the method
> level
> > > (some methods are guarded some not - AFAIK EJB does not allow this
> either).
> > >
> > > I agree that conversation concurrentAccessTimeout in Weld should be
> > > configurable. In fact, it should be possible to change this timeout
> even
> > > now using Weld API and org.jboss.weld.context.ConversationContext. But
> > > it should be definitely more straightforward [2].
> > >
> > > To sum it up - I wouldn't add concurrency control to the spec provided
> > > it's implementable using interceptors. This is a similar situation as
> to
> > > javax.transaction.Transactional and JTA. The best place to specify this
> > > is IMHO "Concurrency Utilities for Java EE".
> > >
> > > Martin
> > >
> > > [1]
> > > http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/
> > >
> > > [2]
> > > https://issues.jboss.org/browse/WELD-2113
> > >
> > > Dne 24.2.2016 v 20:47 Stephan Knitelius napsal(a):
> > >> I just want to bring this to everyone attention one more time.
> > >>
> > >> The conversation scope concurrency control mechanism seems to be a
> > >> frequent point of pain in many projects.
> > >>
> > >> Especially when working with browser triggered asynchronous requests,
> > >> you can not rely on client-sided request synchronization.
> > >> Weld, unlike OWB, grants a 1 second timeout prior to throwing a (the
> > >> specified) BusyConversationException mitigating the effect a bit.
> > >>
> > >> This is a rather strict un-configurable type of CC. Also its
> > >> completely out of alignment with the other build-in scopes, offering
> no
> > >> CC what so ever.
> > >>
> > >> In the cases of Session- and Application-Scope, thread handling is
> left
> > >> entirely to the developer, even so they are just as vulnerable in AJAX
> > >> environments.
> > >>
> > >> We should really consider introducing a common configurable mechanism,
> > >> that is aligned across all scopes (obviously accounting for backwards
> > >> compatibility in the case of conversation scope).
> > >>
> > >> Would really appreciate some feedback.
> > >>
> > >> Kind regards,
> > >>
> > >> Stephan
> > >>
> > >>
> > >>
> > >>
> > >> On Mon, 22 Feb 2016 at 23:10 Reza Rahman <Reza.Rahman(a)oracle.com
> > >> <mailto:Reza.Rahman@oracle.com>> wrote:
> > >>
> > >> We've discussed this issue before. I definitely still think @Lock
> > >> belongs in a modular CDI specification. It would be highly useful
> to
> > >> both @Singleton and @ApplicationScoped. Today if I need to use
> > >> declarative concurrency control for a shared component I am
> > >> essentially forced to use EJB singleton - which shouldn't be the
> > >> case and perhaps should not have been the case past Java EE 6.
> > >>
> > >>
> > >>> On 2/19/2016 5:27 AM, Stephan Knitelius wrote:
> > >>> Hi all,
> > >>>
> > >>> CDI spec does not define a common concurrency control mechanism.
> > >>> The time any type of concurrency control is mentioned is in
> > >>> conjunction with EJB and a rather restrictive one for conversation
> > >>> context.
> > >>>
> > >>> CDI Spec:
> > >>> The container ensures that a long-running conversation may be
> > >>> associated with at most one request at a time, by blocking or
> > >>> rejecting concurrent requests. If the container rejects a request,
> > >>> it must associate the request with a new transient conversation
> > >>> and throw an exception of
> > >>> type|javax.enterprise.context.BusyConversationException|.
> > >>>
> > >>>
> > >>> It would be helpful if a common configurable concurrency mechanism
> > >>> (EJB Singleton style locking?) could be established for all normal
> > >>> scopes.
> > >>>
> > >>> What are your thoughts on this?
> > >>>
> > >>> Regards,
> > >>>
> > >>> Stephan
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> ______________________________________
> > >>> *Stephan Knitelius*
> > >>> Alteburger Str. 274
> > >>> 50968 K?ln / Cologne
> > >>> Deutschland / Germany
> > >>> stephan(a)knitelius.com <mailto:stephan@knitelius.com>
> > >>>
> > >>>
> > >>> _______________________________________________
> > >>> cdi-dev mailing list
> > >>> cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> > >>> https://lists.jboss.org/mailman/listinfo/cdi-dev
> > >>>
> > >>> Note that for all code provided on this list, the provider
> licenses the code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
> > >>
> > >> _______________________________________________
> > >> cdi-dev mailing list
> > >> cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> > >> https://lists.jboss.org/mailman/listinfo/cdi-dev
> > >>
> > >> Note that for all code provided on this list, the provider licenses
> > >> the code under the Apache License, Version 2
> > >> (http://www.apache.org/licenses/LICENSE-2.0.html). For all other
> > >> ideas provided on this list, the provider waives all patent and
> > >> other intellectual property rights inherent in such information.
> > >>
> > >>
> > >>
> > >> _______________________________________________
> > >> cdi-dev mailing list
> > >> cdi-dev(a)lists.jboss.org
> > >> https://lists.jboss.org/mailman/listinfo/cdi-dev
> > >>
> > >> Note that for all code provided on this list, the provider licenses
> the code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
> > >
> > > --
> > > Martin Kouba
> > > Software Engineer
> > > Red Hat, Czech Republic
> > > _______________________________________________
> > > cdi-dev mailing list
> > > cdi-dev(a)lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/cdi-dev
> > >
> > > Note that for all code provided on this list, the provider licenses
> the code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such
> information._______________________________________________
> > cdi-dev mailing list
> > cdi-dev(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/cdi-dev
> >
> > Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
> >
> > Unless stated otherwise above:
> > IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
> 3AU_______________________________________________
> > cdi-dev mailing list
> > cdi-dev(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/cdi-dev
> >
> > Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
> >
> > Unless stated otherwise above:
> > IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
> 3AU
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/cdi-dev/attachments/20160226/525ab6e5/at...
>
> ------------------------------
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
>
> End of cdi-dev Digest, Vol 63, Issue 36
> ***************************************
>
8 years, 9 months
[JBoss JIRA] (CDI-582) Configurable concurrency control for CDI
by Reza Rahman (JIRA)
[ https://issues.jboss.org/browse/CDI-582?page=com.atlassian.jira.plugin.sy... ]
Reza Rahman commented on CDI-582:
---------------------------------
I think this is very important and way past due to further broaden CDI adoption. I'd say this class of CDI features is probably more important than what is currently slated for CDI 2 (which I seriously fear will be basically ignored as low-level stuff not relevant to most real world potential and current CDI users).
> Configurable concurrency control for CDI
> ----------------------------------------
>
> Key: CDI-582
> URL: https://issues.jboss.org/browse/CDI-582
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Contexts
> Affects Versions: 2.0-EDR1
> Reporter: Stephan Knitelius
>
> Currently the spec only defines, a non-configurable, concurrency control mechanism for conversation scope. All other build-in scopes remain unprotected, relaying on the developer.
> It would be useful to introduce EJB Singleton style concurrency control for CDI scopes.
> Allowing the developer to configure the concurrency behavior of ConversationScoped beans, and defining concurrency control for the other build-in scopes.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 9 months
PTO next week
by Antoine Sabot-Durand
Hi guys,
I'll be on vacation next week. Our next meeting will be on march 8th.
Please take time to review open PR.
Antoine
8 years, 9 months
New version for CDI-558
by Antoine Sabot-Durand
Hi guys,
I just push a new version for PR 270
https://github.com/cdi-spec/cdi/pull/270
No more strange inheritance, Builders now use Configurator by composition.
I kept the distinction between configurator and builder to have different
restriction between both.
BeanConfigurator duplicates all methods from BeanAttributesConfigurator, an
alternative might be to compose them (BeanConfigurator consumes a
BeanAttributesConfigurator)
Thanks for your review.
This PR is important to decide how we may manage other ticket like new
version of SE bootstrap (CDI-568) or interceptor on producer (CDI-580)
Antoine
8 years, 9 months
Re: [cdi-dev] Concurrency Control
by Reza Rahman
This is not just a problem with this one feature but a much broader one involving @Asynchronous, @Schedule and many others. Simply punting on this problem and not dealing with this class of problems vigorously is rather foolish. It winds up doing what it has done for years - undermining pretty much all efforts related to Java EE, especially compared to the velocity and effectiveness by which the clear competitors to everything Java EE solve these issues. In the end, we are collectively to blame for the dismal state of affairs in Java EE land because of this sort of thing.
> On Feb 25, 2016, at 4:18 PM, Emily Jiang <EMIJIANG(a)uk.ibm.com> wrote:
>
> 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.
>
>
>
> Many thanks,
> Emily
> ===========================
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone: +44 (0)1962 816278 Internal: 246278
>
> Email: emijiang(a)uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Stephan Knitelius <stephan(a)knitelius.com>
> To: Reza Rahman <reza_rahman(a)lycos.com>, Martin Kouba <mkouba(a)redhat.com>,
> Cc: cdi-dev(a)lists.jboss.org
> Date: 25/02/2016 20:26
> Subject: Re: [cdi-dev] Concurrency Control
> Sent by: cdi-dev-bounces(a)lists.jboss.org
>
>
>
> Hi Martin,
>
> yes this particular issue is about concurrent access control. You are right in pointing out that the lock should be applied
> to the whole been and only override-able on a per method basis (similar to EJB Singleton style locking).
>
> Regarding conversation context, its fair enough to point-out that weld allows for configure the conversation lock timeout.
> However this is only true for Weld, this should really be made part of the specification.
>
> Even if we were to specify a standard way to configure conversation locked timeouts in the CDI specification, it would
> still make the conversation scope the odd one out of the lot. Hence it would be more sensible to design a
> common way to handle concurrent access.
>
> Also I would argue that you cannot implement a common concurrent access control via interceptors,
> since the container will preempt any interceptor based attempt for conversation scoped beans.
>
> As Reza pointed out Oracle has no intend to reopen "Concurrency Utilities for Java EE" at this time and is not
> willing to hand it over to anyone else. The same seems to be true for JTA.
>
> Stephan
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, 25 Feb 2016 at 15:50 Reza Rahman <reza_rahman(a)lycos.com> wrote:
> 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.
>
> > On Feb 25, 2016, at 9:13 AM, Martin Kouba <mkouba(a)redhat.com> wrote:
> >
> > Hi Stephan,
> >
> > I like the idea of CDI interceptor solution you're proposing in your
> > blogpost [1]. However, concurrency is a difficult topic. First of all,
> > this only solves concurrent access to the bean instance (i.e.
> > method-level locking) - the bean state is always up to the user. Also
> > I'm not so sure it's a good idea to only apply @Lock at the method level
> > (some methods are guarded some not - AFAIK EJB does not allow this either).
> >
> > I agree that conversation concurrentAccessTimeout in Weld should be
> > configurable. In fact, it should be possible to change this timeout even
> > now using Weld API and org.jboss.weld.context.ConversationContext. But
> > it should be definitely more straightforward [2].
> >
> > To sum it up - I wouldn't add concurrency control to the spec provided
> > it's implementable using interceptors. This is a similar situation as to
> > javax.transaction.Transactional and JTA. The best place to specify this
> > is IMHO "Concurrency Utilities for Java EE".
> >
> > Martin
> >
> > [1]
> > http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/
> >
> > [2]
> > https://issues.jboss.org/browse/WELD-2113
> >
> > Dne 24.2.2016 v 20:47 Stephan Knitelius napsal(a):
> >> I just want to bring this to everyone attention one more time.
> >>
> >> The conversation scope concurrency control mechanism seems to be a
> >> frequent point of pain in many projects.
> >>
> >> Especially when working with browser triggered asynchronous requests,
> >> you can not rely on client-sided request synchronization.
> >> Weld, unlike OWB, grants a 1 second timeout prior to throwing a (the
> >> specified) BusyConversationException mitigating the effect a bit.
> >>
> >> This is a rather strict un-configurable type of CC. Also its
> >> completely out of alignment with the other build-in scopes, offering no
> >> CC what so ever.
> >>
> >> In the cases of Session- and Application-Scope, thread handling is left
> >> entirely to the developer, even so they are just as vulnerable in AJAX
> >> environments.
> >>
> >> We should really consider introducing a common configurable mechanism,
> >> that is aligned across all scopes (obviously accounting for backwards
> >> compatibility in the case of conversation scope).
> >>
> >> Would really appreciate some feedback.
> >>
> >> Kind regards,
> >>
> >> Stephan
> >>
> >>
> >>
> >>
> >> On Mon, 22 Feb 2016 at 23:10 Reza Rahman <Reza.Rahman(a)oracle.com
> >> <mailto:Reza.Rahman@oracle.com>> wrote:
> >>
> >> We've discussed this issue before. I definitely still think @Lock
> >> belongs in a modular CDI specification. It would be highly useful to
> >> both @Singleton and @ApplicationScoped. Today if I need to use
> >> declarative concurrency control for a shared component I am
> >> essentially forced to use EJB singleton - which shouldn't be the
> >> case and perhaps should not have been the case past Java EE 6.
> >>
> >>
> >>> On 2/19/2016 5:27 AM, Stephan Knitelius wrote:
> >>> Hi all,
> >>>
> >>> CDI spec does not define a common concurrency control mechanism.
> >>> The time any type of concurrency control is mentioned is in
> >>> conjunction with EJB and a rather restrictive one for conversation
> >>> context.
> >>>
> >>> CDI Spec:
> >>> The container ensures that a long-running conversation may be
> >>> associated with at most one request at a time, by blocking or
> >>> rejecting concurrent requests. If the container rejects a request,
> >>> it must associate the request with a new transient conversation
> >>> and throw an exception of
> >>> type|javax.enterprise.context.BusyConversationException|.
> >>>
> >>>
> >>> It would be helpful if a common configurable concurrency mechanism
> >>> (EJB Singleton style locking?) could be established for all normal
> >>> scopes.
> >>>
> >>> What are your thoughts on this?
> >>>
> >>> Regards,
> >>>
> >>> Stephan
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> ______________________________________
> >>> *Stephan Knitelius*
> >>> Alteburger Str. 274
> >>> 50968 Köln / Cologne
> >>> Deutschland / Germany
> >>> stephan(a)knitelius.com <mailto:stephan@knitelius.com>
> >>>
> >>>
> >>> _______________________________________________
> >>> cdi-dev mailing list
> >>> cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> >>> https://lists.jboss.org/mailman/listinfo/cdi-dev
> >>>
> >>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
> >>
> >> _______________________________________________
> >> cdi-dev mailing list
> >> cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> >> https://lists.jboss.org/mailman/listinfo/cdi-dev
> >>
> >> Note that for all code provided on this list, the provider licenses
> >> the code under the Apache License, Version 2
> >> (http://www.apache.org/licenses/LICENSE-2.0.html). For all other
> >> ideas provided on this list, the provider waives all patent and
> >> other intellectual property rights inherent in such information.
> >>
> >>
> >>
> >> _______________________________________________
> >> cdi-dev mailing list
> >> cdi-dev(a)lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/cdi-dev
> >>
> >> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
> >
> > --
> > Martin Kouba
> > Software Engineer
> > Red Hat, Czech Republic
> > _______________________________________________
> > cdi-dev mailing list
> > cdi-dev(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/cdi-dev
> >
> > Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information._______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
8 years, 9 months
Re: [cdi-dev] Concurrency Control
by Reza Rahman
No objections whatsoever. I will put in the JIRAs ASAP so we can give this the attention it deserves.
> On Feb 26, 2016, at 4:32 AM, Emily Jiang <EMIJIANG(a)uk.ibm.com> wrote:
>
> Hi Reza,
>
> I understand your frustration. I would suggest you raising a CDI jira to get all options discussed. Any objections?
>
> Many thanks,
> Emily
> ===========================
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone: +44 (0)1962 816278 Internal: 246278
>
> Email: emijiang(a)uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Reza Rahman <reza_rahman(a)lycos.com>
> To: Emily Jiang/UK/IBM@IBMGB,
> Cc: cdi-dev(a)lists.jboss.org
> Date: 25/02/2016 23:01
> Subject: Re: [cdi-dev] Concurrency Control
> Sent by: cdi-dev-bounces(a)lists.jboss.org
>
>
>
> This is not just a problem with this one feature but a much broader one involving @Asynchronous, @Schedule and many others. Simply punting on this problem and not dealing with this class of problems vigorously is rather foolish. It winds up doing what it has done for years - undermining pretty much all efforts related to Java EE, especially compared to the velocity and effectiveness by which the clear competitors to everything Java EE solve these issues. In the end, we are collectively to blame for the dismal state of affairs in Java EE land because of this sort of thing.
>
> On Feb 25, 2016, at 4:18 PM, Emily Jiang <EMIJIANG(a)uk.ibm.com> wrote:
>
> 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.
>
>
>
> Many thanks,
> Emily
> ===========================
> Emily Jiang
> WebSphere Application Server, CDI Development Lead
>
> MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
> Phone: +44 (0)1962 816278 Internal: 246278
>
> Email: emijiang(a)uk.ibm.com
> Lotus Notes: Emily Jiang/UK/IBM@IBMGB
>
>
>
>
> From: Stephan Knitelius <stephan(a)knitelius.com>
> To: Reza Rahman <reza_rahman(a)lycos.com>, Martin Kouba <mkouba(a)redhat.com>,
> Cc: cdi-dev(a)lists.jboss.org
> Date: 25/02/2016 20:26
> Subject: Re: [cdi-dev] Concurrency Control
> Sent by: cdi-dev-bounces(a)lists.jboss.org
>
>
>
> Hi Martin,
>
> yes this particular issue is about concurrent access control. You are right in pointing out that the lock should be applied
> to the whole been and only override-able on a per method basis (similar to EJB Singleton style locking).
>
> Regarding conversation context, its fair enough to point-out that weld allows for configure the conversation lock timeout.
> However this is only true for Weld, this should really be made part of the specification.
>
> Even if we were to specify a standard way to configure conversation locked timeouts in the CDI specification, it would
> still make the conversation scope the odd one out of the lot. Hence it would be more sensible to design a
> common way to handle concurrent access.
>
> Also I would argue that you cannot implement a common concurrent access control via interceptors,
> since the container will preempt any interceptor based attempt for conversation scoped beans.
>
> As Reza pointed out Oracle has no intend to reopen "Concurrency Utilities for Java EE" at this time and is not
> willing to hand it over to anyone else. The same seems to be true for JTA.
>
> Stephan
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, 25 Feb 2016 at 15:50 Reza Rahman <reza_rahman(a)lycos.com> wrote:
> 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.
>
> > On Feb 25, 2016, at 9:13 AM, Martin Kouba <mkouba(a)redhat.com> wrote:
> >
> > Hi Stephan,
> >
> > I like the idea of CDI interceptor solution you're proposing in your
> > blogpost [1]. However, concurrency is a difficult topic. First of all,
> > this only solves concurrent access to the bean instance (i.e.
> > method-level locking) - the bean state is always up to the user. Also
> > I'm not so sure it's a good idea to only apply @Lock at the method level
> > (some methods are guarded some not - AFAIK EJB does not allow this either).
> >
> > I agree that conversation concurrentAccessTimeout in Weld should be
> > configurable. In fact, it should be possible to change this timeout even
> > now using Weld API and org.jboss.weld.context.ConversationContext. But
> > it should be definitely more straightforward [2].
> >
> > To sum it up - I wouldn't add concurrency control to the spec provided
> > it's implementable using interceptors. This is a similar situation as to
> > javax.transaction.Transactional and JTA. The best place to specify this
> > is IMHO "Concurrency Utilities for Java EE".
> >
> > Martin
> >
> > [1]
> > http://www.knitelius.com/2016/01/25/concurrency-control-for-cdi/
> >
> > [2]
> > https://issues.jboss.org/browse/WELD-2113
> >
> > Dne 24.2.2016 v 20:47 Stephan Knitelius napsal(a):
> >> I just want to bring this to everyone attention one more time.
> >>
> >> The conversation scope concurrency control mechanism seems to be a
> >> frequent point of pain in many projects.
> >>
> >> Especially when working with browser triggered asynchronous requests,
> >> you can not rely on client-sided request synchronization.
> >> Weld, unlike OWB, grants a 1 second timeout prior to throwing a (the
> >> specified) BusyConversationException mitigating the effect a bit.
> >>
> >> This is a rather strict un-configurable type of CC. Also its
> >> completely out of alignment with the other build-in scopes, offering no
> >> CC what so ever.
> >>
> >> In the cases of Session- and Application-Scope, thread handling is left
> >> entirely to the developer, even so they are just as vulnerable in AJAX
> >> environments.
> >>
> >> We should really consider introducing a common configurable mechanism,
> >> that is aligned across all scopes (obviously accounting for backwards
> >> compatibility in the case of conversation scope).
> >>
> >> Would really appreciate some feedback.
> >>
> >> Kind regards,
> >>
> >> Stephan
> >>
> >>
> >>
> >>
> >> On Mon, 22 Feb 2016 at 23:10 Reza Rahman <Reza.Rahman(a)oracle.com
> >> <mailto:Reza.Rahman@oracle.com>> wrote:
> >>
> >> We've discussed this issue before. I definitely still think @Lock
> >> belongs in a modular CDI specification. It would be highly useful to
> >> both @Singleton and @ApplicationScoped. Today if I need to use
> >> declarative concurrency control for a shared component I am
> >> essentially forced to use EJB singleton - which shouldn't be the
> >> case and perhaps should not have been the case past Java EE 6.
> >>
> >>
> >>> On 2/19/2016 5:27 AM, Stephan Knitelius wrote:
> >>> Hi all,
> >>>
> >>> CDI spec does not define a common concurrency control mechanism.
> >>> The time any type of concurrency control is mentioned is in
> >>> conjunction with EJB and a rather restrictive one for conversation
> >>> context.
> >>>
> >>> CDI Spec:
> >>> The container ensures that a long-running conversation may be
> >>> associated with at most one request at a time, by blocking or
> >>> rejecting concurrent requests. If the container rejects a request,
> >>> it must associate the request with a new transient conversation
> >>> and throw an exception of
> >>> type|javax.enterprise.context.BusyConversationException|.
> >>>
> >>>
> >>> It would be helpful if a common configurable concurrency mechanism
> >>> (EJB Singleton style locking?) could be established for all normal
> >>> scopes.
> >>>
> >>> What are your thoughts on this?
> >>>
> >>> Regards,
> >>>
> >>> Stephan
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> ______________________________________
> >>> *Stephan Knitelius*
> >>> Alteburger Str. 274
> >>> 50968 Köln / Cologne
> >>> Deutschland / Germany
> >>> stephan(a)knitelius.com <mailto:stephan@knitelius.com>
> >>>
> >>>
> >>> _______________________________________________
> >>> cdi-dev mailing list
> >>> cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> >>> https://lists.jboss.org/mailman/listinfo/cdi-dev
> >>>
> >>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
> >>
> >> _______________________________________________
> >> cdi-dev mailing list
> >> cdi-dev(a)lists.jboss.org <mailto:cdi-dev@lists.jboss.org>
> >> https://lists.jboss.org/mailman/listinfo/cdi-dev
> >>
> >> Note that for all code provided on this list, the provider licenses
> >> the code under the Apache License, Version 2
> >> (http://www.apache.org/licenses/LICENSE-2.0.html). For all other
> >> ideas provided on this list, the provider waives all patent and
> >> other intellectual property rights inherent in such information.
> >>
> >>
> >>
> >> _______________________________________________
> >> cdi-dev mailing list
> >> cdi-dev(a)lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/cdi-dev
> >>
> >> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
> >
> > --
> > Martin Kouba
> > Software Engineer
> > Red Hat, Czech Republic
> > _______________________________________________
> > cdi-dev mailing list
> > cdi-dev(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/cdi-dev
> >
> > Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information._______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU_______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
8 years, 9 months
Concurrency Control
by Stephan Knitelius
Hi all,
CDI spec does not define a common concurrency control mechanism. The time
any type of concurrency control is mentioned is in conjunction with EJB and
a rather restrictive one for conversation context.
CDI Spec:
The container ensures that a long-running conversation may be associated
with at most one request at a time, by blocking or rejecting concurrent
requests. If the container rejects a request, it must associate the request
with a new transient conversation and throw an exception of type
javax.enterprise.context.BusyConversationException.
It would be helpful if a common configurable concurrency mechanism (EJB
Singleton style locking?) could be established for all normal scopes.
What are your thoughts on this?
Regards,
Stephan
______________________________________
*Stephan Knitelius*
Alteburger Str. 274
50968 Köln / Cologne
Deutschland / Germany
stephan(a)knitelius.com
8 years, 9 months
Is a wildcard type an unresolved type variable or not
by Martin Kouba
Hi all,
This follows up on my last message to cdi-dev: "Type variable check for
Event.select() and Event.fire()".
After I spend some time searching I have to rephrase the question:
Should a wildcard type be considered an unresolved type variable or not?
Of course, in the scope of events. I believe the spec is not clear here.
See also "10.1. Event types and qualifier types" and "10.2.1. The Event
interface".
There is CDI-494 which assumes a wildcard type _is_ an unresolved type
variable [1].
From the TCK point of view - there is only
FireEventTest.testTypeVariableEventTypeFails() which assumes that a type
variable resolved to a wildcard (inferred from the Event injection
point) is unresolvable - see also CDITCK-510 [2].
Note that in CDI 1.0 the container cannot use the Event specified type
to infer the parameterized type.
The current behavior
====================
Weld 1 allows to pass a wildcard to Event.select() but Event.fire() is
problematic (e.g. the snippet [3] does fail).
Weld 2+ is imho overly strict here and throws IllegalArgumentException
whenever a type variable is resolved to a wildcard type (Event.select(),
Event.fire()).
The latest OWB seems to support this, but it does not always infer the
parameterized type consistently (e.g. the TCK test mentioned above is
passing even if it's possible to resolve the type variable to the
wildcard type).
Clarification
=============
I'm no expert on generics but I think we shouldn't treat wildcard types
as unresolved type variables, i.e. reject CDI-494 and clarify the
snippet [3] and similar should work. At least I cannot see any problem.
But maybe I'm missing somethig.
Thanks for feedback,
Martin
[1]
https://issues.jboss.org/browse/CDI-494
[2]
https://issues.jboss.org/browse/CDITCK-510
[3]
@Inject
Event<Object> event;
public void testSelectSubtypeWithWildcard() {
List<String> updatedList = new ArrayList<>();
updatedList.add("foo");
Event<List<?>> child = event.select(new TypeLiteral<List<?>>() {});
child.fire(updatedList);
}
8 years, 9 months
Type variable check for Event.select() and Event.fire()
by Martin Kouba
Hi all,
I'd like to discuss the following two sentences taken from "10.2.1. The
Event interface").
1. Event.select()
"If the specified type contains a type variable, an
IllegalArgumentException is thrown."
So what should happen if you pass a raw type like List.class? The
Class.getTypeParameters() method returns [E]. Does it mean the type
contains a type variable? And what about "event.select(new
TypeLiteral<List<?>>() {})"?
2. Event.fire()
"If the runtime type of the event object contains an unresolvable type
variable, an IllegalArgumentException is thrown."
To my understanding:
1. the runtime type = eventPayload.getClass()
2. get type variables = getTypeParameters()
3. unresolvable = it's not possible to resolve the variable, nor from
the Event injetion point nor from the selected type (Event.select()),
anything else?
3. Example snippet
Should the following snippet fail or not? It currently fails in Weld
during event.select(). But even if we relax the check it will not be
always possible to resolve all the type variables, i.e. the subsequent
{{fire()}} invocation might fail. Or am I missing anything?
@Inject
Event<Object> event;
public void testSelectSubtypeWithWildcard() {
List<String> updatedList = new ArrayList<>();
updatedList.add("foo");
Event<List<?>> child = event.select(new TypeLiteral<List<?>>() {});
child.fire(updatedList);
}
Thanks,
Martin
8 years, 9 months