September 2019
Intermediate to advanced
816 pages
18h 47m
English
A thread, t1, that waits for an explicit period of time for another thread, t2, to finish is in the TIMED_WAITING state.
This scenario is shaped in the following snippet of code:
The code snippet is as follows:
public class TimedWaitingThread { public void timedWaitingThread() { Thread t = new Thread(() -> { Thread.sleep(2000); }); t.start(); Thread.sleep(500); System.out.println("TimedWaitingThread t: " + t.getState()); // TIMED_WAITING ...