Hi Azeez,

The CarbonContext initializes things like the Cache Manager and the JNDI
InitialContextFactoryBuilder. These have been created in a way that existing
Java code can use these constructs without being aware of multi-tenancy and
the existence of the CarbonContext. Also, the CarbonContext cannot be
explicitly initialized and will only be initialized on the first call you
make to it in order to retrieve the current context instance. This is why
this has been added to Main.java (the same has been added to our
BridgeServlet to get this to work when we deploy on AppServers).

Thanks,
Senaka.

On Fri, Mar 11, 2011 at 5:23 PM, Afkham Azeez <az...@wso2.com> wrote:

> Senaka,
> Can you please explain why the following lines of code are necessary in the
> Main class? Why can't we do that where the CarbonContext is needed?
>
> // Enforce the initialization of the CarbonContextHolder prior to starting
> the server. This
>         // will make it possible to do required initializations for
> Multi-Tenant JNDI and caching.
>         CarbonContextHolder.getCurrentCarbonContextHolder();
>
>
>
>
> --
> *Afkham Azeez*
> Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com,
> *
> *
> *Member; Apache Software Foundation; 
> **http://www.apache.org/*<http://www.apache.org/>
> *
> email: **az...@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
> *
> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
> *
> *
> *Lean . Enterprise . Middleware*
>
>


-- 
*Senaka Fernando*
Product Manager - WSO2 Governance Registry;
Associate Technical Lead; WSO2, Inc.; http://wso2.com*
Member; Apache Software Foundation; http://apache.org

E-mail: senaka AT wso2.com
**P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
Linked-In: http://www.linkedin.com/in/senakafernando

*Lean . Enterprise . Middleware
_______________________________________________
Carbon-dev mailing list
Carbon-dev@wso2.org
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to