在不查看JVM源码的情况下,通过JAVA层的注释分析Object对象
有如下注释:
Wakes up a single thread that is waiting on this object's * monitor (notify方法)
The current thread must own this object's monitor.(wait方法)
源码中这种“object's monitor”比比皆是
由此,可以的出第一个结论:
1. object有一个monitor
继续分析
This method causes the current thread (call it <var>T</var>) to * place itself in the wait set for this object and then to relinquish
The thread <var>T</var> is then removed from the wait set for this * object and re-enabled for thread scheduling.
由此可以得到第二个结论
2. object有一个wait set
继续分析
The current thread must own this object's monitor
Only one thread at a time can own an object's monitor.
由此我们可以得到结论
3. thread可以own object's monitor
......