First thing i think i should say is that i am not looking for a solution , this is hwk , but it runs correctly , what would help me greatly is come clarification..
Thread calls notifyAll
upon termination in support of the join
functionality. This is documented in the Javadoc for Thread#join:
This implementation uses a loop of
this.wait
calls conditioned onthis.isAlive
. As a thread terminates thethis.notifyAll
method is invoked. It is recommended that applications not usewait
,notify
, ornotifyAll
onThread
instances.
There are essentially two conclusions then:
join
.wait
otherwise, do not use a Thread instance as a monitor.