Top "Executorservice" questions

ExecutorService is a Java object containing the managed pool of threads and capable of scheduling the submitted tasks for these threads.

How to wait for all threads to finish, using ExecutorService?

I need to execute some amount of tasks 4 at a time, something like this: ExecutorService taskExecutor = Executors.newFixedThreadPool(4); while(...) { taskExecutor.…

java multithreading concurrency parallel-processing executorservice
ExecutorService, how to wait for all tasks to finish

What is the simplest way to to wait for all tasks of ExecutorService to finish? My task is primarily computational, …

java multithreading threadpool executorservice
How to get thread id from a thread pool?

I have a fixed thread pool that I submit tasks to (limited to 5 threads). How can I find out which …

java multithreading threadpool executorservice executors
Handling exceptions from Java ExecutorService tasks

I'm trying to use Java's ThreadPoolExecutor class to run a large number of heavy weight tasks with a fixed number …

java multithreading exception executorservice threadpoolexecutor
Naming threads and thread-pools of ExecutorService

Let's say I have an application that utilizes the Executor framework as such Executors.newSingleThreadExecutor().submit(new Runnable(){ @Override public …

java threadpool runnable executorservice managedthreadfactory
Java Timer vs ExecutorService?

I have code where I schedule a task using java.util.Timer. I was looking around and saw ExecutorService can …

java timer scheduled-tasks scheduling executorservice
Executors.newCachedThreadPool() versus Executors.newFixedThreadPool()

newCachedThreadPool() versus newFixedThreadPool() When should I use one or the other? Which strategy is better in terms of resource utilization?

java multithreading concurrency executorservice threadpoolexecutor
ExecutorService that interrupts tasks after a timeout

I'm looking for an ExecutorService implementation that can be provided with a timeout. Tasks that are submitted to the ExecutorService …

java multithreading concurrency executorservice
Choose between ExecutorService's submit and ExecutorService's execute

How should I choose between ExecutorService's submit or execute, if the returned value is not my concern? If I test …

java multithreading executorservice
What is the difference between ExecutorService.submit and ExecutorService.execute in this code in Java?

I am learning to use ExectorService to pool threads and send out tasks. I have a simple program below import …

java multithreading threadpool executorservice