The container reads the bean's deployment descriptor plus any additional
deployment information, and creates a context for the bean.
Each time the bean is being accessed that context is associated with the
current context returned by InitialContext.
One simple way to achieve that is using ThreadLocal, associating the
naming context with the current thread.
arkin
PS
If you're looking for a code sample, go to http://tyrex.exolab.org,
download the sources and take a look at the package
src/main/tyrex/naming. It implements the JNDI ENC for both EJBs and
Servlets (same principle).
"Kulkarni, Salil" wrote:
>
> It seems a given bean's environment in JNDI "java:comp/" namespace is "visible" to
>only instances of that bean. I was wondering how is that implemented. Since a bean
>simply calls "new InitialContext()", how does the container know which bean is
>calling it and hence how can it return the context that contains that bean's
>environment ? Any insight would be appreciated.
>
> Regards,
> Salil Kulkarni
> Compaq Computers Inc.
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
--
----------------------------------------------------------------------
Assaf Arkin www.exoffice.com
CTO, Exoffice Technologies, Inc. www.exolab.org
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".