[JBoss JIRA] (CDI-527) allow proxying of classes with non-private final methods
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-527?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand edited comment on CDI-527 at 3/9/16 4:43 AM:
------------------------------------------------------------------
To sum up. We need to find the best name for the annotation (suggestions welcome) and add the SPI part for this feature. [~struberg] what is your proposed roadmap on the PR update?
was (Author: antoinesabot-durand):
To sum up. We need to find the best name for the annotation (suggestions welcome) and add the SPI part for this feature. [~struberg] what is your roadmap on the PR update.
> allow proxying of classes with non-private final methods
> --------------------------------------------------------
>
> Key: CDI-527
> URL: https://issues.jboss.org/browse/CDI-527
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 1.2.Final
> Reporter: Mark Struberg
> Assignee: Mark Struberg
> Fix For: 2.0 (proposed)
>
>
> Currently we explicitly disallow proxying of classes with non-private final methods.
> EJB _does_ allow this. And there are a few final methods in the JDK and other libs. E.g. HashMap#initHashSeedAsNeeded. Currently we cannot have a producer method for it.
> We might rethink our decision and allow it. Probably with an own annotation like @AllowProxying which disables this check for certain cases (subclass managed-beans or producers).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 7 months
[JBoss JIRA] (CDI-527) allow proxying of classes with non-private final methods
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-527?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand commented on CDI-527:
------------------------------------------
To sum up. We need to find the best name for the annotation (suggestions welcome) and add the SPI part for this feature. [~struberg] what is your roadmap on the PR update.
> allow proxying of classes with non-private final methods
> --------------------------------------------------------
>
> Key: CDI-527
> URL: https://issues.jboss.org/browse/CDI-527
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 1.2.Final
> Reporter: Mark Struberg
> Assignee: Mark Struberg
> Fix For: 2.0 (proposed)
>
>
> Currently we explicitly disallow proxying of classes with non-private final methods.
> EJB _does_ allow this. And there are a few final methods in the JDK and other libs. E.g. HashMap#initHashSeedAsNeeded. Currently we cannot have a producer method for it.
> We might rethink our decision and allow it. Probably with an own annotation like @AllowProxying which disables this check for certain cases (subclass managed-beans or producers).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 7 months
[JBoss JIRA] (CDI-587) Propose a way to propagate an existing context
by Romain Manni-Bucau (JIRA)
[ https://issues.jboss.org/browse/CDI-587?page=com.atlassian.jira.plugin.sy... ]
Romain Manni-Bucau updated CDI-587:
-----------------------------------
Description:
The overall idea is to ensure that it is not cause the code becomes asynchronous/reactive/... that we loose the instances or get another context.
An example is starting an AsyncContext in a servlet.
One proposal is to add a flag to ask for propagation of the context in async managed threads: @RequestScoped(inherited = true) which would reuse the same instances for these "new" threads.
Note however this issue is not only bound to servlets even if it is the easiest example.
The original thread disucssion on the list: http://cdi-development-mailing-list.1064426.n5.nabble.com/RequestScope-Li...
was:
The overall idea is to ensure that it is not cause the code becomes asynchronous/reactive/... that we loose the instances or get another context.
An example is starting an AsyncContext in a servlet.
One proposal is to add a flag to ask for propagation of the context in async managed threads: @RequestScoped(inherited = true) which would reuse the same instances for these "new" threads.
Note however this issue is not only bound to servlets even if it is the easiest example.
> Propose a way to propagate an existing context
> ----------------------------------------------
>
> Key: CDI-587
> URL: https://issues.jboss.org/browse/CDI-587
> Project: CDI Specification Issues
> Issue Type: Epic
> Components: Contexts
> Affects Versions: 1.2.Final
> Reporter: Romain Manni-Bucau
>
> The overall idea is to ensure that it is not cause the code becomes asynchronous/reactive/... that we loose the instances or get another context.
> An example is starting an AsyncContext in a servlet.
> One proposal is to add a flag to ask for propagation of the context in async managed threads: @RequestScoped(inherited = true) which would reuse the same instances for these "new" threads.
> Note however this issue is not only bound to servlets even if it is the easiest example.
> The original thread disucssion on the list: http://cdi-development-mailing-list.1064426.n5.nabble.com/RequestScope-Li...
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 7 months
RequestScope Life Cycle
by Reza Rahman
Let's hope some of the implementors weigh in on this some time soon.
I could write some tests on this but I would have no idea if I would have uncovered a bug given the ambiguity of the current spec text.
> On Mar 8, 2016, at 3:16 AM, arjan tijms <arjan.tijms(a)gmail.com> wrote:
>
> Hi,
>
>> On Mon, Mar 7, 2016 at 8:08 PM, Reza Rahman <reza_rahman(a)lycos.com> wrote:
>> Reading over the CDI spec definition for request scoped beans, I am a tad confused. When are request scoped beans being destroyed right now? Are they just bound to the Servlet request thread and destroyed as soon as the service method returns?
>
> In case of a Servlet request (request scoped beans are also tied to other kinds of "requests"), it's indeed not clear. In practice it looks like the moment between the first ServletRequestListener#requestInitialized and ServletRequestListener#requestDestroyed.
>
> The exact scope is troublesome for security too, since in most severs the request scope (and session scope and application scope) is active when a SAM is called (the SAM gets an HttpServletRequest after all), but this is not the case in all servers. E.g. in Liberty the RequestScope starts AFTER a SAM is called.
>
> Kind regards,
> Arjan Tijms
>
>
>
>> In case of asynchronous Servlets, are they kept around until the real HTTP request actually completes the same way the underlying HTTP connection is kept around? Or is that too difficult because it would require integration at a very low level with the Servlet implementation?
>>
>> There's some language around asynchronous completion right now but it's not very clear what actually happens. Does the onComplete, etc asynchronous callback basically create new request scoped instances?
>>
>> > On Mar 7, 2016, at 10:28 AM, Reza Rahman <reza_rahman(a)lycos.com> wrote:
>> >
>> > Even in the most conservative reading of this, the spec is clearly not disallowing it.
>> >
>> >> On Mar 7, 2016, at 10:05 AM, Mark Struberg <struberg(a)yahoo.de> wrote:
>> >>
>> >> The question is whether the spec does allow us to do it. And if other containers consequently do it as well.
>> >>
>> >> If it does then I will implement it in TomEE.
>> >>
>> >> LieGrue,
>> >> strub
>> >>
>> >>
>> >>> Am 07.03.2016 um 14:06 schrieb Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>
>> >>> What this is saying is that it is not recommended to use them because of the possible life-cycle mismatch. If they are not supposed to work at all, the specification would have simply stated it won't work.
>> >>>
>> >>> Anyway personally I have no reason to further discuss this. I'm going to try to find a way to get this done for developers sooner rather than later. If TomEE does not want to do it, too bad for developers.
>> >>>
>> >>>> On Mar 7, 2016, at 3:49 AM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>> >>>>
>> >>>> "
>> >>>> Tasks that are submitted to a managed instance of ExecutorService may still be running after the lifecycle of the submitting component. Therefore, CDI beans with a scope of @RequestScoped, @SessionScoped, or @ConversationScoped are not recommended to use as tasks as it cannot be guaranteed that the tasks will complete before the CDI context is destroyed.
>> >>>> "
>> >>>>
>> >>>> States that the context is not inherited, is that what you mean?
>> >>>>
>> >>>>
>> >>>>
>> >>>> Romain Manni-Bucau
>> >>>> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
>> >>>>
>> >>>> 2016-03-07 5:57 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>> The specification currently references pretty much all the major CDI scopes specifically with the issue of propagation and lifecycle in mind. Please see section 2.3.
>> >>>>
>> >>>>> On Mar 6, 2016, at 11:53 PM, Mark Struberg <struberg(a)yahoo.de> wrote:
>> >>>>> Specifically
>> >>>>> The containers mimic ejb for propagation for a good reason!
>> >>>>> No session e.g. , new TX, etc
>> >>>>>
>> >>>>> Sadly the concurrency utilis only mention @ApplicationScoped, so the Request Context not only doesn't get propagated (which is good), but also doesn't get set up (which is crap).
>> >>>>>
>> >>>>> LieGrue,
>> >>>>> Strub
>> >>>>>
>> >>>>>> Am 06.03.2016 um 23:03 schrieb John D. Ament <john.d.ament(a)gmail.com>:
>> >>>>>>
>> >>>>>> I agree, in a sense, with what you're saying. There's nothing in this spec that says it wouldn't be propagated. However, there's nothing in this spec that states clearly that CDI contexts are propagated.
>> >>>>>>
>> >>>>>> If you look at the RI, the RI only seems to propagate transaction state. Considering the age of the spec, I'm not surprised to see that. The worst part is that right now, outside of the ASF, all other EE7 impls seem to be using the RI for concurrency.
>> >>>>>>
>> >>>>>> I'm fairly certain that from this spec's standpoint, the only thing that's actually propagated is the transaction.
>> >>>>>>
>> >>>>>> John
>> >>>>>>
>> >>>>>> On Sun, Mar 6, 2016 at 4:50 PM Reza Rahman <reza_rahman(a)lycos.com> wrote:
>> >>>>>> I am re-reading the spec end to end again right now. So far it seems I have remembered everything correctly.
>> >>>>>>
>> >>>>>> You should read over section 2.3. What it is saying is that a container implementing the Java EE concurrency utilities should ensure whatever contextual information is needed for managed components to work correctly should be propagated automatically. For the correct implementation of CDI scopes, this should also mean any currently active scopes. The section you are referring to is basically implying that thinking that it is possible to use these scoped beans in tasks (albeit not reliably since beans could go out of scope before the thread finishes - for example if the request ends).
>> >>>>>>
>> >>>>>> This does not have anything to do with the context service per se. The context service is an SPI of sorts to allow end user developers to do for their own applications what the container does behind the scenes for managed component context propagation.
>> >>>>>>
>> >>>>>> I'll read over the entire spec to see if there is anything to contradict this. If that's not the case what Romain is describing is most likely an implementation specific bug that did not take into account CDI scope propagation.
>> >>>>>>
>> >>>>>>> On Mar 6, 2016, at 4:23 PM, John D. Ament <john.d.ament(a)gmail.com> wrote:
>> >>>>>>>
>> >>>>>>> Reza,
>> >>>>>>>
>> >>>>>>> I read through the concurrency utils spec. Was there a specific section you had in mind? The only references to CDI were near the beginning warning users to not use Request/Session scoped beans as tasks since the outer most context may be destroyed before the work is done.
>> >>>>>>>
>> >>>>>>> I have a feeling what you're referring to is the context service: http://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/ContextSe...
>> >>>>>>>
>> >>>>>>> If that's the case, then basically this should work OOTB right?
>> >>>>>>>
>> >>>>>>> Task task = new MyTask();
>> >>>>>>> task = contextService.createContextualProxy(task, Task.class);
>> >>>>>>> executor.submit(task);
>> >>>>>>>
>> >>>>>>> // now magically the context should be prop'd?
>> >>>>>>>
>> >>>>>>> Is that about right?
>> >>>>>>>
>> >>>>>>> John
>> >>>>>>>
>> >>>>>>> On Sun, Mar 6, 2016 at 3:30 PM Reza Rahman <reza_rahman(a)lycos.com> wrote:
>> >>>>>>> Have you actually looked at the EE concurrency spec text in detail? What does it say about managed component context propagation?
>> >>>>>>>
>> >>>>>>> Without actually doing that further discussing this is just taking shots in the dark. As an implementer it should not surprise you that this might simply be a bug because the person implementing the concurrency utilities for the EE runtime was not told about what to copy over into the new thread for CDI to work correctly.
>> >>>>>>>
>> >>>>>>>> On Mar 6, 2016, at 3:06 PM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> 2016-03-06 20:59 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>>>>>> As far as I know this is precisely the sort of thing that the EE concurrency spec is intended for. It is supposed to copy over everything from the underlying thread local context into the new thread for all EE managed components to function. Since CDI beans are also EE container managed, it also applies to CDI beans as well. The EE vendor is supposed to make sure this works properly.
>> >>>>>>>>
>> >>>>>>>> I don't think the concurrency utilities specifically lists APIs for which thread context propagation should work. If this doesn't work in a specific implementation it's most likely because they didn't take CDI into account in their own EE concurrency implementation.
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> That's what I wanted/would like. CDI TCK breaks it quite easily and @RequestScoped which is *used* today is sadly a @ThreadLocalScoped badly named. So to solve it we would need another scope as I mentionned several times on this list 100% matching servlet instances lifecycles (on a pure CDI side we have the same issue for sessions which are recycled during a request, the session scope is corrupted *by spec* in term of user behavior).
>> >>>>>>>>
>> >>>>>>>>> On Mar 6, 2016, at 2:45 PM, John D. Ament <john.d.ament(a)gmail.com> wrote:
>> >>>>>>>>>
>> >>>>>>>>> The section of the spec you link to makes no references to threads. 6.3 makes some notes about normal scopes and threads, and specifically says that a context is bound to one or more threads.
>> >>>>>>>>>
>> >>>>>>>>> I think what's happened is that over the years, people have simply bound HTTP Request == single thread, but when async processing was introduced no one thought to clarify that the spawning of a child thread from the original HTTP request retains the parent's context.
>> >>>>>>>>>
>> >>>>>>>>> This is another requested feature, but looks more like a bug or gap in the spec.
>> >>>>>>>>>
>> >>>>>>>>> John
>> >>>>>>>>>
>> >>>>>>>>> On Sun, Mar 6, 2016 at 2:37 PM Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>> >>>>>>>>> 2016-03-06 20:25 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>>>>>>> Let's see. I suspect the specification text for EE concurrency is generic enough for implementations to also be able to cover CDI scopes or any other Java EE API context propagation needs. This means the issue needs to be solved at the individual implementation level. Changing anything in the spec is probably just unnecessary ceremony in this case.
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> Then 1. concurrency- utility can't be reliable for "EE" users, 2. CDI still prevent it to work since it would violate the spec to propagate it while request scope is bound to another thread (http://docs.jboss.org/cdi/spec/1.1/cdi-spec.html#request_context handles async listener but not the main AsyncContext part).
>> >>>>>>>>>
>> >>>>>>>>>> On Mar 6, 2016, at 2:15 PM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> 2016-03-06 19:42 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>>>>>>>> This frankly surprises me. I'll check the specification text. This might indeed just be an implementation bug. The EE concurrency utilities are supposed to be copying all relevant context. If this is an issue than it has to be that it is not copying enough of the HTTP request context for CDI to work.
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> The issue is not technical since I got it working but needed to reverse. From my understanding ee concurrency utilities was done in a time CDI was not there so it just ignored it somehow and it hasnt been updated when integrated to the spec. Now with the wording of the CDI - and TCK - it is impossible to make it working since request scope is bound the thre request thread - and not the request. Side note: same applies to session scope and conversation.
>> >>>>>>>>>>
>> >>>>>>>>>> Surely the Red Hat folks can quickly shed some light here since they implement essentially this whole stack?
>> >>>>>>>>>>
>> >>>>>>>>>>> On Mar 6, 2016, at 1:30 PM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>> >>>>>>>>>>>
>> >>>>>>>>>>> 2016-03-06 19:20 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>>>>>>>>> Can you kindly try to make the example a bit simpler? It's important to make the case for how likely this is supposed to occur in most business applications.
>> >>>>>>>>>>>
>> >>>>>>>>>>> Also, other than making sure that the executor service is propagating thread local request contexts correctly what other solution are you proposing? Did you check the specification? How sure are you that this isn't simply an implementation bug?
>> >>>>>>>>>>>
>> >>>>>>>>>>> As far as I know the executor service is supposed to be preserving all relevant parts of the EE context?
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>> Not in concurrency-utilities for EE at least. That was the first impl I did then Mark pointed out it was violating CDI spec and request scope definition. There is a kind of contracdiction there cause concurrency-utilities doesn't integrate with CDI at all but we can also see it the opposite way: CDI doesn't provide any way to propagate a context in another thread. Both point of view are valid so we need to see where we tackle it.
>> >>>>>>>>>>>
>> >>>>>>>>>>>> On Mar 6, 2016, at 12:35 PM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> does https://gist.github.com/rmannibucau/d55fce47b001185dca3e help?
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> Idea is to give an API to make:
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> public void complete() {
>> >>>>>>>>>>>> try {
>> >>>>>>>>>>>> asyncContext.complete();
>> >>>>>>>>>>>> } finally {
>> >>>>>>>>>>>> auditContext.end();
>> >>>>>>>>>>>> }
>> >>>>>>>>>>>> }
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> working without hacky and almost impossible context pushing (cause of injections nature you are not supposed to know what to push in the context when going async).
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> Romain Manni-Bucau
>> >>>>>>>>>>>> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> 2016-03-06 16:40 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>> >>>>>>>>>>>> Can you kindly share an annotated code example of the proposed solution so we can all follow and discuss this?
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> On Mar 6, 2016, at 9:31 AM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wroteshar:
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>> Hi guys,
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> spoke on concurrency utilities about the ability to inherit a cdi scope. Idea is to follow request scope more than cdi spec allows. First thought it was a concurrency utilities thing but Reza mentionned can be a CDI one so here it is.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Sample:
>> >>>>>>>>>>>>> In a servlet i get MyBean which is @RequestScoped, I do some set on it. The i go async (AsyncContext) and trigger a task in another thread. It would be neat - and mandatory in some case by the loose coupling nature of CDI - to get the *same* MyBean *instance* in this thread. With a direct dependency you can easily use message passing pattern - but you loose the loose coupling cause you need to know until which level you unwrap, think t principal case which has 2-3 proxies!. However in practice you have a lot of undirect dependencies, in particular with enterprise concerns (auditing, security...) so you can't really do it easily/naturally.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Bonus:
>> >>>>>>>>>>>>> One very verbose way is to be able to kind of push/pop an existing context in a thread - wrappers doing it on a Runnable/Consumer/Function/... would be neat.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Question:
>> >>>>>>>>>>>>> Would CDI handle it in 2.0?
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Side note: this is really about the fact to reuse a "context context" (its current instances map) in another thread the more transparently possible and match the user vision more than a technical question for now.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Romain Manni-Bucau
>> >>>>>>>>>>>>> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
>> >>>>>>>>>>>>> _______________________________________________
>> >>>>>>>>>>>>> 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.
>> >>>>>>>>>>>
>> >>>>>>>>>>> _______________________________________________
>> >>>>>>>>>>> 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.
>> >>>>>>>>>
>> >>>>>>>>> _______________________________________________
>> >>>>>>>>> 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.
>> >>>>>>>>
>> >>>>>>>> _______________________________________________
>> >>>>>>>> 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.
>> >>>>>>> _______________________________________________
>> >>>>>>> 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.
>> >>>>>> _______________________________________________
>> >>>>>> 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.
>> >>> _______________________________________________
>> >>> 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, 7 months
[JBoss JIRA] (CDI-587) Propose a way to propagate an existing context
by Romain Manni-Bucau (JIRA)
Romain Manni-Bucau created CDI-587:
--------------------------------------
Summary: Propose a way to propagate an existing context
Key: CDI-587
URL: https://issues.jboss.org/browse/CDI-587
Project: CDI Specification Issues
Issue Type: Epic
Components: Contexts
Affects Versions: 1.2.Final
Reporter: Romain Manni-Bucau
The overall idea is to ensure that it is not cause the code becomes asynchronous/reactive/... that we loose the instances or get another context.
An example is starting an AsyncContext in a servlet.
One proposal is to add a flag to ask for propagation of the context in async managed threads: @RequestScoped(inherited = true) which would reuse the same instances for these "new" threads.
Note however this issue is not only bound to servlets even if it is the easiest example.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 7 months
[JBoss JIRA] (CDI-586) Add spec text for new Literals
by Tomas Remes (JIRA)
[ https://issues.jboss.org/browse/CDI-586?page=com.atlassian.jira.plugin.sy... ]
Tomas Remes commented on CDI-586:
---------------------------------
I just realized that InjectLiteral could be useful as well (used in TCK). Others which came to our minds (with Martin) could be VetoedLiteral and ObservesLiteral...but that's probably questionable.
> Add spec text for new Literals
> ------------------------------
>
> Key: CDI-586
> URL: https://issues.jboss.org/browse/CDI-586
> Project: CDI Specification Issues
> Issue Type: Clarification
> Reporter: Antoine Sabot-Durand
> Assignee: Antoine Sabot-Durand
> Fix For: 2.0-EDR2
>
>
> CDI-485 introduced literals in the API. We should add some information about them in the spec as well
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 7 months
Re: [cdi-dev] CompletableFuture vs. CompletionStage
by Reza Rahman
FYI I am running a survey on this issue: https://twitter.com/reza_rahman/status/707035213717774336. If you really are open to feedback, I suggest keeping an eye there. When it is done, it is possible I will blog about this if it is clear this is a going to be a problem. In the least people will hopefully have that as a resource when they are confused.
The reality is that everyone has limited time. I can provide feedback when I can provide feedback for any number of personal reasons including whether my employer allows it. It is ultimately up to you to consider it fairly and objectively at all times. If you are failing to do that for any reason before the spec is final it is rather unfortunate for anyone relying on the spec.
In the end the beauty of all of this is that none of this impacts my livelihood immediately any more. I am just another developer again now. In the end I get to walk over to the Spring camp like everyone else. And thank goodness for that freedom.
Kindly do not assume I will be spending a lot of time providing you feedback going forward. That was unlikely at all times given my time constraints. You should assume the same for most developers out there. When you get feedback from us, you should consider it in that light.
> On Mar 8, 2016, at 5:37 AM, Antoine Sabot-Durand <antoine(a)sabot-durand.net> wrote:
>
> Answer inline
>
>> Le mar. 8 mars 2016 à 03:15, Reza Rahman <reza_rahman(a)lycos.com> a écrit :
>> I have forwarded this issue to the Java EE platform EG for review. My inclination now is to simply leave this alone with a final earnest request to kindly think carefully about this before finalizing and getting this into the real world. Please keep in mind that the average developer is not that skilled and looks to resources on the web routinely for answers. All those resources are going to immediately point to CompletableFuture, not some obscure superclass.
>
> CS is not an obscure superclass it's an interface and all methods in CF returns it, so it's impossible to learn CF and ignore CS existence.
> Concurrency is not an easy feature to use, people that think they can cut and paste code from stack overflow without digging in the doc will hit a wall very soon.
> We decided to return a CS to allow advanced user to use it to build async pipeline from here. I guess that the majority of beginners will ignore this returned object (as they would have do it if it had been a CF).
>
>>
>> All I am trying to do is help design an API that is not going to immediately become difficult for the average end developer to understand and use. It's rather unfortunate that I am already feeling fed up in that simple effort to provide feedback.
>
> Reza, feedback is always welcome. But if you don't do it in time you should expect some resistance from the EG who worked a long time (and in an open way) to take these decision. So you need more arguments than "user don't know CS" to make us switch from an interface to an impl, that is not suited for Java EE.
> Feedback on possible technical issues are welcome.
>
>>
>> Anyway I am now basically done with this. Unfortunately I have far more urgent matters for Java EE 7 and Java EE 8 to deal with. If I have time I'll look at some more of the CDI 2 work and provide feedback if I can manage time.
>
> Again it's welcome. We are about to discuss a programmatic APi for SE boot. Your input will be precious here.
>
>>
>>> On Mar 7, 2016, at 2:53 PM, Reza Rahman <reza_rahman(a)lycos.com> wrote:
>>> Argue
>>> Yes, this can be done with a CompletableFuture that has already been constructed - just take a look at the API.
>>>
>>> As far as not adding it to CDI, I can see either way. What was the original motivation for adding CompletableFutures?
>>>
>>> Also, it's a good idea to run this by the platform expert group. I know at least JAX-RS is planning to use CompletableFutures for their client API.
>>>
>>>> On Mar 7, 2016, at 2:39 PM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>>>>
>>>>
>>>> 2016-03-07 20:35 GMT+01:00 Reza Rahman <reza_rahman(a)lycos.com>:
>>>>> Talking with a colleague about this he reminded me of an important fact I almost forgot. The CompletableFuture API can actually be used with custom executors. That means users concerned about managed threads in a Java EE environment can use it with existing EE 7 concurrency executors.
>>>>>
>>>>> Basically this means CompletableFutures are already pretty Java EE ready.
>>>>>
>>>>> If this is the main cited reason for using CompletionStage, is it really that valid of an argument to justify yet another custom subclass specific only to CDI instead of what's likely to be far more familiar and expected?
>>>>>
>>>>
>>>> Did he mention it is true for *created* comlpetion future which is not the case for async events? But this is a good point to not add anything to CDI: the feature is a one liner *already*.
>>>>
>>>>>> On Mar 7, 2016, at 8:11 AM, Reza Rahman <reza_rahman(a)lycos.com> wrote:
>>>>>>
>>>>>> I think this is a very bad idea. It's better not to use either API and wait to sort out how CompletableFuture can be used in EE consistently. Because of backwards compatibility rules, it is better to have no API than a bad API.
>>>>>>
>>>>>>> On Mar 7, 2016, at 3:45 AM, Romain Manni-Bucau <rmannibucau(a)gmail.com> wrote:
>>>>>>>
>>>>>>> 2016-03-07 9:07 GMT+01:00 Martin Kouba <mkouba(a)redhat.com>:
>>>>>>>>
>>>>>>>> Dne 7.3.2016 v 09:03 Romain Manni-Bucau napsal(a):
>>>>>>>>>
>>>>>>>>> Le 7 mars 2016 08:35, "Martin Kouba" <mkouba(a)redhat.com
>>>>>>>>> <mailto:mkouba@redhat.com>> a écrit :
>>>>>>>>> >
>>>>>>>>> > Dne 6.3.2016 v 15:39 Romain Manni-Bucau napsal(a):
>>>>>>>>> >
>>>>>>>>> >> Hi guys,
>>>>>>>>> >>
>>>>>>>>> >> as a user having a ComlpetionStage makes me loose some JDK utilities,
>>>>>>>>> >> can we move back to CompletionFuture?
>>>>>>>>> >>
>>>>>>>>> >> It would allow for instance:
>>>>>>>>> >>
>>>>>>>>> >> // doesn't work with CompletionStage
>>>>>>>>> >> CompletionFuture.allOf(event1.fireAsync(...), event2.fireAsync(...))
>>>>>>>>> >> .then(...)
>>>>>>>>> >
>>>>>>>>> >
>>>>>>>>> > Well, this should work if the underlying CompletionStage impl
>>>>>>>>> supports toCompletableFuture(), i.e. in Weld 3:
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>> Yes but it is not natural to convert it IMO = we can do better
>>>>>>>>>
>>>>>>>>> > CompletableFuture.allOf(event1.fireAsync(...).toCompletableFuture(),
>>>>>>>>> event2.fireAsync(...).toCompletableFuture())
>>>>>>>>> >
>>>>>>>>> > AFAIK the default async execution facility of CompletableFuture is
>>>>>>>>> ForkJoinPool.commonPool() which is not a good fit for Java EE. Using the
>>>>>>>>> CompletionStage interface allows us to wrap the async calls without the
>>>>>>>>> specified executor (e.g. CompletionStage.thenApplyAsync(Function<? super
>>>>>>>>> T, ? extends U>)) and supply a default one provided by the impl.
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>> Should use the pool in which the evznt is fired then "then step" is
>>>>>>>>> synchronous is my sample so all is decided at fire time
>>>>>>>>
>>>>>>>> I don't talk about your particular example - I understand that it's not using async exec (although the "then()" method does not exist).
>>>>>>>>
>>>>>>>
>>>>>>> was supposed to represent the different flavours (thenRun, thenCompose, ...) ;).
>>>>>>>
>>>>>>> That said I agree on the state switching the pool is better but with these 2 notes:
>>>>>>>
>>>>>>> - could be better to hide these poorly designed methods then -> don't use CompletionXXX but a CDI API with a bridge to CompletionX to let the user go back on SE tools
>>>>>>> - we still don't have a *standard* config for the pool(s) underlying CDI features so it sounds as poor as SE solution IMO (at least a core/max/ttl config in beans.xml)
>>>>>>>
>>>>>>>>>
>>>>>>>>> >
>>>>>>>>> >>
>>>>>>>>> >> 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>
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>> >>
>>>>>>>>> >> _______________________________________________
>>>>>>>>> >> 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.
>>>>>>>>> >>
>>>>>>>>> >
>>>>>>>>> > --
>>>>>>>>> > Martin Kouba
>>>>>>>>> > Software Engineer
>>>>>>>>> > Red Hat, Czech Republic
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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.
>>>>
>> _______________________________________________
>> 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, 7 months