Re: context classloader

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Vadim Nasardinov <vadimn(at)redhat(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: context classloader
Date: 2005-01-18 23:07:48
Message-ID: 41ED96C4.9030401@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Vadim Nasardinov wrote:

> Another reasonable course of action might be to try the context classloader:
> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html#getContextClassLoader%28%29
>
> This would typically have the system classloader in its parent hierarchy,
> but it may also give you access to locations that the system classloader
> cannot see.

I am of the opinion that thread context classloaders are evil and should
be avoided if at all possible -- they make code fragile and sensitive to
caller context (almost by definition!)

Also it'd mean that we would have to load the defaults on every call to
getConnection(), rather than once per Driver instance (i.e. most
probably exactly once). Does it make sense to have the driver defaults
change depending on who is obtaining the connection?

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vadim Nasardinov 2005-01-19 03:08:21 Re: context classloader
Previous Message Vadim Nasardinov 2005-01-18 22:34:45 context classloader (was: Re: 8.0 drivers released.)