Java classloader delegation model ?

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-04-15T03:49:33Z Indexed on 2010/04/15 3:53 UTC
Read the original article Hit count: 149

Filed under:

When calling a loadClass() on a class loader, the class loader firstly check the class if had been loaded or directly delegate this check to it's parent class loader ?

Java api says:

When requested to find a class or resource, a ClassLoader instance will delegate the search for the class or resource to its parent class loader before attempting to find the class or resource itself.

But there's a specific chapter about class loader in the book <java reflection in action> and says:

Class loader calls findLoadedClass to check if the class has been loaded already.If a class loader does not find a loaded class, calls loadClass on the parent class loader.

which is correct ?

© Stack Overflow or respective owner

Related posts about java