[cdi-dev] API Only PR for Context management

arjan tijms arjan.tijms at gmail.com
Mon May 16 08:47:45 EDT 2016


Hi,

On Mon, May 16, 2016 at 1:54 PM, John D. Ament <john.d.ament at gmail.com>
wrote:

> That sounds like a separate issue.
>

It is technically indeed, but the new context controller is the closest
thing to date that I've seen. It's *almost* there.


> We want all of the app servers to behave the same way, I wouldn't expect
> this change to fix that, or even to make it so that libraries could fix
> that.
>
> Maybe there's a missing TCK assertion?
>

Root problem is the JSR 196 spec is silent on this. I would have likely
been doing the work for a JSR 196 MR that would clarify this by about now,
but then the entire "resource problem" situation started, and even though I
would practically be doing all the work, this MR never got off the ground.

Another option though is to add it to the CDI spec, as that one currently
references all the other specs for which the build-in scopes should be
active. E.g. in 6.7.1 it now says:

"during the service() method of any servlet in the web application, during
the doFilter() method of any servlet filter and when the container calls
any ServletRequestListener or AsyncListener,"

This should become something like:

"during the service() method of any servlet in the web application, during
the doFilter() method of any servlet filter and when the container calls
any ServletRequestListener, AsyncListener or ServerAuthContext,"

To make it extra clear, but slightly longer:

"during the service() method of any servlet in the web application, during
the doFilter() method of any servlet filter and when the container calls
any ServletRequestListener, AsyncListener or ServerAuthContex (and by
extension therefor its embedded ServerAuthModules, if any) for the Servlet
Container Profile,"

Thoughts?

Kind regards,
Arjan Tijms











>
>
>>
>> Kind regards,
>> Arjan Tijms
>>
>>
>>
>>
>>> In addition, I think you're looking for the equivalent of
>>> Context.isActive. Part of me even wonders if swapping around the impl to be
>>> Context.activate() and Context.deactivate() may be better from a domain
>>> standpoint.
>>>
>>> What I'm looking for is a way to start contexts possibly earlier than a
>>>> specific container implementation normally starts them, and stop them
>>>> possibly later. If the context is started earlier in say a request, then
>>>> eventually the container will also start that same context later in the
>>>> request. If that will throw an exception the request will not proceed,
>>>> which is of course not intended.
>>>> Likewise, when the container stops the context this will thus be too
>>>> early.
>>>> With a wrapped context controller, the startContexts and stopContexts
>>>> calls can be ignored for those contexts the application (extension/library)
>>>> wanted to start earlier and stop later. This does of course assume that the
>>>> container itself will also use this context controller instead of the
>>>> current proprietary code.
>>>> Additionally, the PR does not contain the check anymore to see if the
>>>> context is already active or already stopped. Is that still intended to be
>>>> added? This would be particularly useful for code that needs to be portable
>>>> between different containers, where one container may already have started
>>>> the context at a given point, where another container has not (catching the
>>>> exception would be an alternative here but is obviously not so nice).
>>>> Another point, what about letting the caller of the startContexts
>>>> method optionally pass in the objects (or a lambda to obtain them) on which
>>>> that context primarily depends (if any). E.g. for the request scope, pass
>>>> in an HttpServletRequest instance.
>>>
>>> Would it be an idea to set a wrapped (or decorated) context controller?
>>>
>>
>>> On Sun, May 15, 2016 at 6:33 PM, John D. Ament <john.d.ament at gmail.com>
>>> wrote:
>>
>> All,
>>
>> I've started a PR for API changes to support starting/stopping the built
>>> in contexts, which you can find here:
>>> https://github.com/cdi-spec/cdi/pull/291/files
>>
>> It's visibly based on what is in DeltaSpike's CDI Ctrl plus some of the
>>> external stuff (e.g.
>>> https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/api/src/main/java/org/apache/deltaspike/scheduler/api/Scheduled.java#L40 )
>>> so I'd like to get some input.
>>
>> I don't suspect that this will be an SE only feature, today I use
>>> programmatic context starting even while on an app server.  Even though I'm
>>> not using whats provided in DS, it was identified as a clear cross cutting
>>> concern hence why there's an interceptor as well.
>>
>> John
>>
>> _______________________________________________
>>
>> cdi-dev mailing list
>>
>> cdi-dev at 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.
>>
>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160516/eb4aad45/attachment-0001.html 


More information about the cdi-dev mailing list