-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 All,
On 5/23/13 10:40 AM, Christopher Schultz wrote: > Chuck, > > On 5/22/13 1:42 PM, Caldarale, Charles R wrote: >>> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >>> Subject: Re: Follow-up: Possible false-postive with >>> JreMemoryLeakPreventionListener and Tomcat's JDBC Pool and >>> OracleTimeoutPollingThread > >>> I suspect that the DriverManager will always be loaded by the >>> boot ClassLoader, since the default-dispatch for ClassLoaders >>> is to chekc the parent first, then check "yourself". The >>> DriverManager is at the top-level (well, there is primordial, >>> but that doesn't really count) ClassLoader so you'll always >>> get that. > >> Terminology alert: you're confusing the boot class loader with >> the system class loader, and have erroneously labeled the actual >> boot class loader as "primordial". Generally speaking, the boot >> class loader is responsible for extracting JRE classes from >> rt.jar (and others that come with the JRE), while the system >> class loader deals with those specified by the java.class.path >> setting (CLASSPATH for those still stuck on environment >> variables). > > Thanks for the pedantry: I was in fact ignoring the difference > between the system and boot ClassLoaders. However, the primordial > ClassLoader does in fact exist, and does in fact load classes, and > is not called the "boot" ClassLoader. > > Oracle describes the primordial ClassLoader as that which loads > pretty much everything in the java.* package space. Oracle also > describes the "system" ClassLoader as the "delegation root ancestor > of all class loaders".[1] > > In practice, the primordial class loader is identified by a "null" > reference (and is this difficult to inspect) and the system class > loader is represented by an "ExtClassLoader". On top of that is an > AppClassLoader. I'll have to play around with some classes loaded > via endorsed directories to see if I can nail-down how to get a > Class with the "ExtClassLoader" as its class loader instead of > AppClassLoader. > > DriverManager's ClassLoader is in fact null, the primordial class > loader. > > You can test it yourself, and discover the ClassLoader hierarchy > in play with a simple program: > > public class ClassLoaderTest { public static void main(String[] > args) { printClassLoaders(ClassLoaderTest.class); > printClassLoaders(Thread.class); printClassLoaders(Object.class); > printClassLoaders(java.sql.DriverManager.class); } public static > void printClassLoaders(Class cls) { ClassLoader cl = > cls.getClassLoader(); > > System.out.println("*** ClassLoaders for " + cls.getName() + " > ***"); while(null != cl) { System.out.println("ClassLoader[" + > cls.getName() + "]: " + cl); cl = cl.getParent(); } > System.out.println("ClassLoader[" + cls.getName() + "]: " + cl); } > } > > Run under two different JVMs on my laptop, I get: > > $ java -showversion ClassLoaderTest java version "1.7.0_17" > Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java > HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode) > > *** ClassLoaders for ClassLoaderTest *** > ClassLoader[ClassLoaderTest]: > sun.misc.Launcher$AppClassLoader@63644028 > ClassLoader[ClassLoaderTest]: > sun.misc.Launcher$ExtClassLoader@4ab03512 > ClassLoader[ClassLoaderTest]: null *** ClassLoaders for > java.lang.Thread *** ClassLoader[java.lang.Thread]: null *** > ClassLoaders for java.lang.Object *** > ClassLoader[java.lang.Object]: null *** ClassLoaders for > java.sql.DriverManager *** ClassLoader[java.sql.DriverManager]: > null > > $ java ClassLoaderTest java version "1.6.0_45" Java(TM) SE Runtime > Environment (build 1.6.0_45-b06-451-11M4406) Java HotSpot(TM) > 64-Bit Server VM (build 20.45-b01-451, mixed mode) > > *** ClassLoaders for ClassLoaderTest *** > ClassLoader[ClassLoaderTest]: > sun.misc.Launcher$AppClassLoader@a6eb38a > ClassLoader[ClassLoaderTest]: > sun.misc.Launcher$ExtClassLoader@69cd2e5f > ClassLoader[ClassLoaderTest]: null *** ClassLoaders for > java.lang.Thread *** ClassLoader[java.lang.Thread]: null *** > ClassLoaders for java.lang.Object *** > ClassLoader[java.lang.Object]: null *** ClassLoaders for > java.sql.DriverManager *** ClassLoader[java.sql.DriverManager]: > null > > $ java -showversion ClassLoaderTest java version "1.6.0_45" > Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406) > Java HotSpot(TM) Client VM (build 20.45-b01-451, mixed mode) > > *** ClassLoaders for ClassLoaderTest *** > ClassLoader[ClassLoaderTest]: > sun.misc.Launcher$AppClassLoader@cf2c80 > ClassLoader[ClassLoaderTest]: > sun.misc.Launcher$ExtClassLoader@1729854 > ClassLoader[ClassLoaderTest]: null *** ClassLoaders for > java.lang.Thread *** ClassLoader[java.lang.Thread]: null *** > ClassLoaders for java.lang.Object *** > ClassLoader[java.lang.Object]: null *** ClassLoaders for > java.sql.DriverManager *** ClassLoader[java.sql.DriverManager]: > null > > -chris Forgot my reference: http://docs.oracle.com/javase/6/docs/technotes/guides/security/spec/security-spec.doc5.html -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJRnje7AAoJEBzwKT+lPKRY4xEP/3rr4XfZ8aRhlMqgH6EJfvbR 7JB6UVGU8oQOTDW4rhpsG9yLFkb5sLKSmA2OOzK0POTYXgSVKeJbAlLOSOMFoCsz seupY0H0Mj5lK/G2m+cv/v/YMu9HC4CCNrRDWfVtiQuoUC18SpXSPFvP5xa9LlmE H6L9iicNT+YJQxeuglFzj4ajadhUOifH0hJVJM5dwGGx86XagvO+lDwIwE5wDIzY dWYMAu7yFk5DFjJe3NiuH+Fi8zxrbBByakZQ7UOvJPxfHKqqH/oWLe9PxLHb+MnJ 8UPmIHUmAs9mFK69MnssozVh53RX9ju5camzuSzVGuqvMCOxjob5huyHqhLM48/n Q36lDDH1os6ipHHzj0cfaiPOc8UzCaxrPOd4jIaxkgFeD3WzUlg+p055Lw8aa58/ Bnrd92LpUpJS/JkBWSF1Ax7nc9wukiRz6vxnTxeXuoRzo9I9jgnZsxyxPz+AsP9f obdlTWKlkSHAfB3zXifkTg3Nv/VaPUV3ODB0ZhVpOEPRa6EyH0o1Pv5S/8tXk3u7 UC9zZJHXy0wo80X1qyZFlQxa6Q4nz58PCNHa+wNRYQ/iY7Dig4MQc1SZ3oa9l57I TUVxEd0IRfovmYNVk1qOkV0hr3KbLI9wDb8qsjLp6oVAYku2zzkxXAaQfCSVTBSP MQgJhG9YoA793rkxvtYU =Z4l7 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org