Sorry for being such a pain , but I have yet another question. Does the garbage collector run in it's own thread? If so, is it considered a user thread or a daemon thread? I heard somewhere that the gc cannot outlive the last user thread - which would make sense because it would be rather silly to run the gc even after the application has ended (which occurs once the last user thread has died and the system kills off all remaining daemon threads). So, does this imply somehow that the gc is a daemon thread??? Thank you!!!
Finalizer is not the g.c. thread. It is the thread that calls the finalize methods. It is an instance of java.lang.ref.Finalizer.FinalizerThread. In the source code for it there is no implementation of the algorithms used in a g.c. I guess the g.c. is implemented in the same language as the JVM and is part of it. By the way, ReferHandler is an instance of java.lang.ref.Reference.ReferenceHandler and it enques the registered Reference objects. Hey Val, for something curious call your code within the finalize method of 10000 thousand garbage collectable objects, and call System.gc() When the main thread dissapears, the finalizer still goes on a bit, but a thread named DestroyJavaVM shows up for a while.
SCJP2. Please Indent your code using UBB Code
Joined: Aug 26, 2001
Thank you for that useful information Jose. Now I'm screwed up Sorry Gisselle if I have provided the wrong information.