Re: context classloader - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: context classloader
Date
Msg-id 41ED96C4.9030401@opencloud.com
Whole thread Raw
In response to context classloader (was: Re: 8.0 drivers released.)  (Vadim Nasardinov <vadimn@redhat.com>)
Responses Re: context classloader
List 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

pgsql-jdbc by date:

Previous
From: Vadim Nasardinov
Date:
Subject: context classloader (was: Re: 8.0 drivers released.)
Next
From: Vadim Nasardinov
Date:
Subject: Re: context classloader