Saved Bookmarks
| 1. |
How To Terminate A Thread In Executor Framework In Java? |
|
Answer» ExecutorService provides a method awaitTermination(LONG timeout, TIMEUNIT UNIT) that takes time and unit of time as an arguments. After that time thread pool is TERMINATED. Suppose we need to terminate a task just now, then we can do as ExecutorService.awaitTermination(0, TimeUnit.SECONDS) ExecutorService provides a method awaitTermination(long timeout, TimeUnit unit) that takes time and unit of time as an arguments. After that time thread pool is terminated. Suppose we need to terminate a task just now, then we can do as ExecutorService.awaitTermination(0, TimeUnit.SECONDS) |
|