From: Alexandre Oliva (oliva@dcc.unicamp.br)
Date: Thu Dec 17 1998 - 16:32:24 EST
On Dec 17, 1998, Godmar Back <gback@cs.utah.edu> wrote:
> Since we keep the entries in the class pool until the loader is finalized
Does this mean finalizer() or quasi-finalizer-like finalization?
> static initializer won't ever be run twice because the VM won't ask
> the classloader to load/define a class. If the loader attempts it
> itself, it will see duplicate definition cause the entry pool is
> consulted.
Are you telling me that a Class won't be unloaded until its
ClassLoader is finalized? If this is the case, it's correct.
Otherwise, a class like this breaks when loaded by a ClassLoader:
class test {}
public class Test {
void foo() {
while(true) {
Test.class.getClassLoader().loadClass("test");
System.gc();
}
}
}
Based on your description, if the class test is ever unloaded,
loadClass will fail to reload it, which is wrong. That's why all
classes loaded by a ClassLoader must be kept loaded until the
ClassLoader itself is garbage-collected.
-- Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org} oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org} Universidade Estadual de Campinas, SP, Brasil
This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:21 EDT