[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A query on the classloader architecture
From: |
Archie Cobbs |
Subject: |
Re: A query on the classloader architecture |
Date: |
Sun, 11 Jul 2004 17:43:56 -0500 (CDT) |
Chris Gray wrote:
> During bootstrapping, a native code (C) classloader is used to load the most
> fundamental classes; Object, Class, String, Thread, etc.. This classloader
> only searches one file, namely the first .jar or .zip in the bootstrap
> classpath (normally this is wre.jar). As soon as it is possible to run Java
> bytecode a Java bootstrap classloader is created, and this classloader
> inherits all classes loaded by the native code. The Java bootstrap class
> loader will load classes and system resources from the whole bootstrap class
> path (-Xbootclasspath). All requests to load a class in java.* or wonka.* are
> dispatched to the system class loader, by-passing the class loader hierarchy.
>
> Classes which are loaded by the Java bootstrap classloader will return a
> reference to the Java bootstrap classloader as class.getClassLoader().
> Classes which are loaded by the native code classloader will return null
> (this could change), as will primitive data types. We have not seen any
> problems resulting from this, but some code written to a Java 1.1 security
> model could fail if it assumes classloader null <=> system class.
>
> The extension class loader is created only if java.ext.dirs.path exists. It
> loads classes from this path, and its parent is the (Java) bootstrap class
> loader.
>
> The application class loader loads classes from -classpath/$CLASSPATH, and is
> responsible for loading the application specified on the command line. Its
> parent is the extension class loader if this exists, the (Java) bootstrap
> class loader otherwise.
So.. (I hope this doesn't sound like an annoying question) what is the
point of creating your "Java bootstrap classloader" ? Why not just let
your primoridal native code class loader fill this role as well? Is all
you're trying to do is prevent getClassLoader() from ever returning null?
If so, a separate question which underlies this whole discussion is
is whether that goal is worthwhile or not.. guess the jury's still out.
Thanks,
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com