On Wed, 01 Feb 2006 08:17:33 +0100, baliuka juozas <[EMAIL PROTECTED]> wrote:


Thread.getContextCL() is the only way.  If a library
doesn't use
Thread.getCCL() then it is a poorly written library.

No, this kind of library it just not designed to be
used as shared library, if library is deployed with
application then "MyClass.class.getClassLoader()" is
the right classloder (you do not want to have more
than one classloader per application). Thread.getCCL()
is usefull for container provider libraries or for
exotic application deployment (in shared/lib) to save
memory for class instances.

No! ;) Anything else than *very special cases* should always
consult the current thread context classloader and if that
does not help then MyClass.class.getClassLoader() or any other
"fallback" classloader.

And a library that is not designed to be a library is a poor library ;)

"you do not want to have more than one classloader per application", exactly thus always
use the ONE classloader - thread ctx classloader

"to save memory for class instances." ...no it is to ensure the same class is loaded the same way everytime..otherwise the same named class can become incompatible with later loaded classes - especially if the libraries tries to invoke application/user provided code.

...and yes, this case is mostly visible in "container" scenarios as J2EE, but almost any kind of app will get to that level very fast (even in standalone rich clients) and thus all libraries (no exceptions) should use Thread.getCCL() by default (if not the only way) otherwise
they are useless in most applications.

--
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to