You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Mark Struberg <st...@yahoo.de> on 2010/08/11 22:46:48 UTC

DefaultContextsService question

Hoi!

Why is it needed to hold the ApplicationContext in a ThreadLocal?

    private static ThreadLocal<ApplicationContext> applicationContext = null;

Each BeanManager gets an own ContextService instance anyway, so a simple private 
member would easily work!

Any thoughts?

LieGrue,
strub


      

Re: DefaultContextsService question

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Because, specs says "current thread context", as we discussed on irc




________________________________
From: Mark Struberg <st...@yahoo.de>
To: dev@openwebbeans.apache.org
Sent: Wed, August 11, 2010 11:46:48 PM
Subject: DefaultContextsService question

Hoi!

Why is it needed to hold the ApplicationContext in a ThreadLocal?

    private static ThreadLocal<ApplicationContext> applicationContext = null;

Each BeanManager gets an own ContextService instance anyway, so a simple private 

member would easily work!

Any thoughts?

LieGrue,
strub


Re: DefaultContextsService question

Posted by Joseph Bergmark <be...@apache.org>.
Makes sense to me.  Seems it should be shared across the whole app and
not ThreadLocal.

Sincerely,

Joe

On Wed, Aug 11, 2010 at 4:46 PM, Mark Struberg <st...@yahoo.de> wrote:
> Hoi!
>
> Why is it needed to hold the ApplicationContext in a ThreadLocal?
>
>    private static ThreadLocal<ApplicationContext> applicationContext = null;
>
> Each BeanManager gets an own ContextService instance anyway, so a simple private
> member would easily work!
>
> Any thoughts?
>
> LieGrue,
> strub
>
>
>
>