"Tuyệt vời. Hôm nay tôi đã học được rất nhiều điều mới. Đặc biệt là về trạng thái luồng."
"Ồ, tuyệt quá. Sau đây, hãy kiểm tra kiến thức của bạn:"
14
Nhiệm vụ
Java Multithreading, mức độ, bài học
Đã khóa
A switch for threads
Process the list of threads depending on their state:
1. If the thread isn't running yet, then start it.
2. If the thread is waiting, then interrupt it.
3. If the thread is running, check the isInterrupted flag.
4. If the thread has stopped running, then display its priority on the console.
14
Nhiệm vụ
Java Multithreading, mức độ, bài học
Đã khóa
No idiots
1. Create a private MyUncaughtExceptionHandler class that waits half a second when catching an exception,
and then display the secretKey, thread name, and exception message.
Use String.format(...). Example:
super secret key, Thread-0, This is an example.
14
Nhiệm vụ
Java Multithreading, mức độ, bài học
Đã khóa
Monitoring thread state
Create a LoggingStateThread thread class,
which will display all of the states (State) of the thread passed to the constructor.
The LoggingStateThread thread must terminate itself after the thread passed to the constructor has stopped.
The main() method is not tested.