Tag Archives: Executor
ExecutorService feature was come with Java 5. It extends Executor interface and provides thread pool feature to execute asynchronous short tasks.
There are five ways to execute the tasks asyncronously by using ExecutorService interface provided Java 6.
ExecutorService execService = Executors.newCachedThreadPool();
This method of the approach creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. These pools will typically improve the performance of programs that execute many short-lived asynchronous tasks. If no existing thread is available, a new thread will be created and added to the pool. Threads that have not been used for 60 seconds are terminated and removed from the cache.