Edit:
Oh, you're talking about the innermost Thread object. Inside join() we see a wait() . Sort of:
while (isAlive()) { wait(0); }
notify() for this is handled by the Thread subsystem. When the run() method completes, notify() is called on the Thread object. I am not sure if it is possible to see the code that actually calls notify() - this is apparently executed in the native code.
No user code should call notify() for this Thread object. Java Thread code handles this internally. Once the thread ends, the call to join() will return.
For example, the following code will run fine, and the join() call will be canceled without notify() or notify() .
Thread thread = new Thread(new Runnable() { public void run() {
It is important to note that this behavior should probably not be relied upon. The call to notify() is internal to the notify() system. You should use join() if you expect the thread to complete.
source share