I am continuing my path to deep understanding of Java Thread. Unfortunately my Java Certification didn’t cover that part, so the only way of learning is to post a series of dumb questions. With so many years of Java Development, I am sometimes wondering how much I still have to learn 🙂
In particular my attention is now with the reference handler thread.
"Reference Handler" daemon prio=10 tid=0x02da3400 nid=0xb98 in Object.wait() [0x0302f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x1aac0320> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:485)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
- locked <0x1aac0320> (a java.lang.ref.Reference$Lock)
Now some questions are following, for some of them I know the answer, but I am not posting it, because I would like to hear someone else opinions:
- What is the Reference Handler thread supposed to do ?
- A thread dump should be considered bottom up, why does the stack trace start with locked, shouldn’t the lock statement appears at least after the thread has run ?
- What does “Native Method” means ?
- Why “Unknown Source”, in which case the thread dump cannot recall the source code ?
- Lastly the waiting on and locked has the same , why ?
as usual, I kindly ask to answer all the questions, so that I can mark answered.
java.lang.ref.Reference$Lockwas locked in the method mentioned in the line preceding it (i.e inReferenceHandler.run()..classfile doesn’t contain any source code location information (at least for this specific point). This can happen either when the method is a synthetic one (doesn’t look like it here), or the class was compiled without debug information.waiting onwithout a correspondinglocked.