Sleeping a thread
- It is used to sleep a thread for the specified amount of time
1. Syntax
- public static void sleep(long miliseconds)throws InterruptedExceptioin
- public static void sleep(long miliseconds, int nanos)throws InterruptedException
2. Example
- At a time only one thread is executed
- If you sleep a thread for the specified time, the thread schedular pick up another thread
'Back-End > Java_1' 카테고리의 다른 글
[Java] Joining a thread (0) | 2016.10.07 |
---|---|
[Java] Call a run() directly instead start() (0) | 2016.10.07 |
[Java] Thread Scheduler (0) | 2016.10.07 |
[Java] Creating thread (0) | 2016.10.05 |
[Java] Life cycle of a thread (0) | 2016.10.05 |