You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by Denis Weerasiri <dd...@gmail.com> on 2012/03/09 13:16:31 UTC

Reason for the class loader change

I'm reviewing this method org.apache.ode.il.dbutil.Database#lookupInJndi .
I'm wondering why this class loader change comes in to place. Can someone
explain?

    @SuppressWarnings("unchecked")
    public <T> T lookupInJndi(String objName) throws Exception {
        ClassLoader old = Thread.currentThread().getContextClassLoader();

Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        ...
        ...

        finally {
            Thread.currentThread().setContextClassLoader(old);
        }
    }
-- 
Thanks,
Denis
----------------------------------------------------------
*Denis Weerasiri*
*
*
<http://wso2.com/>**** <http://wso2.com/>*site: **
https://sites.google.com/site/ddweerasiri/*<https://sites.google.com/site/ddweerasiri/>
*blog: **http://ddweerasiri.blogspot.com* <http://ddweerasiri.blogspot.com/>
*
twitter: **http://twitter.com/ddweerasiri* <http://twitter.com/ddweerasiri>*
linked-in: **http://lk.linkedin.com/in/ddweerasiri*<http://lk.linkedin.com/in/ddweerasiri>