Java Reference
In-Depth Information
public final void
join(long millis)
tHRows InterruptedException
Waits for this thread to finish or for the specified number of
milliseconds to elapse, whichever comes first. A time-out of
zero milliseconds means to wait forever. If the thread is inter-
rupted while it is waiting you will get an
InterruptedException
.
public final void
join(long millis, int nanos)
tHRows InterruptedEx-
ception
Waits for this thread to finish, with more precise timing.
Again, a total time-out of zero nanoseconds means to wait
forever. Nanoseconds are in the range 0999,999.
public final void
join()
throws InterruptedException
Equivalent to
join(0)
.
Internally,
join
is defined in terms of
isAlive
and can be logically con-
sidered to act as if written as
while (isAlive())
wait();
with the understanding that the runtime system will invoke
notifyAll
when the thread actually terminates.