I will register the ticket now but I won't have time to fix it until tomorrow. Here's a preview https://github.com/karlkilden/openwebbeans/commit/0b39aba0594dec50ef96d9e403787c3ac5032cc9?diff=unified
I am not sure what style you want on the patch. I broke out some methods but maybe you prefer as small change as possible? I will also include tests unless it's complicated for some reason Cheers On 2 March 2016 at 14:53, Romain Manni-Bucau <[email protected]> wrote: > wonder if throwing an exception context not active instead of logging > passes the tcks, if so can be enough. > > > 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-03-02 14:29 GMT+01:00 Thomas Andraschko <[email protected]> > : > >> Thats true Romain... >> >> We have some code where we need to check if we are running in an http >> request and not e.g. in a background worker or on startup, to determine if >> we can take some settings from the user session. >> >> As i said, it's no problem if you are checking RequestScoped && >> SessionScoped. RequestScoepd is not active and therefor the >> lazyStartSessionContext >> will not happen. >> >> so +0, it was just an idea :) >> >> 2016-03-02 14:20 GMT+01:00 Romain Manni-Bucau <[email protected]>: >> >>> About the log: originally it was not there and it is a nightmare to >>> understand OWB is not well setup in your container. The log shouldn't >>> happear - as much as you shouldn't even try to use session scope in a >>> thread where it is not available theorically. A consensus can be to log it >>> once but in "big" (like taking 20 lines of logs just to say something is >>> not correct). A step further can be to return a fake context never active >>> in such cases. >>> >>> Wydt? >>> >>> >>> 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-03-02 13:56 GMT+01:00 Thomas Andraschko < >>> [email protected]>: >>> >>>> The method in deltaspike is ok, it just checks if the context is active >>>> in the current thread. >>>> >>>> +1 for jira and a patch. >>>> >>>> 2016-03-02 13:47 GMT+01:00 Karl Kildén <[email protected]>: >>>> >>>>> Right, Deltaspike hides the ugly that you call a boolean method but >>>>> instead of false you get ContextNotActiveException. One of the more >>>>> mystical parts of the specification if you ask me. Maybe you are >>>>> refereeing >>>>> to how the BeanManager should behave if the thread is not managed? >>>>> >>>>> It is simply a little bit over my head but at least nothing in the >>>>> javadoc for ContextUtils in deltaspike forbids usage from unmanaged >>>>> threads >>>>> and frankly if that was a requirement it seems like a poor idea to offer >>>>> such static methods in the first place since managed threads have >>>>> injectionpoints. >>>>> >>>>> Regarding a JIRA och a patch: I will take care of it. >>>>> >>>>> Thanks for helping me understanding this better >>>>> >>>>> cheers / Kalle >>>>> >>>> >>>> >>> >> >
