ExecutorService
-
CallableStaticPL/JAVA 2019. 8. 21. 22:39
1. Overview Whereas Runnable object can not return a result, Callable return a result and throw a checked exception in spite of being executed inside a thread likewise. 2. Description 2.1 Callable Callable interface has a single method call() which is meant to contain the code is executed by a thread. Callable callable = new Callable() { @Override public String call() throws Exception { // Perfo..
-
Executors Framework and Thread PoolsStaticPL/JAVA 2019. 8. 21. 20:39
1. Overview Naive Thread management by extending the Thread class or implementing the Runnable interface has a problem when an application requires creating 20 or 30 threads for running tasks concurrently. Executors Framework is creating and managing threads for a production-ready application like hundreds, if not thousands of threads running simultaneously. 2. Description 2.1 Executor Functiona..