Top "Executorservice" questions

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

shutdown and awaitTermination which first call have any difference?

What is the difference between ExecutorService eService = Executors.newFixedThreadPool(2); eService.execute(new TestThread6()); eService.execute(new TestThread6()); eService.execute(new …

java multithreading executorservice
FixedThreadPool vs CachedThreadPool: the lesser of two evils

I have a program that spawns threads (~5-150) which perform a bunch of tasks. Originally, I used a FixedThreadPool because …

java multithreading threadpool executorservice java.util.concurrent
How to give name to a callable Thread?

I am executing a Callable Object using ExecutorService thread pool. I want to give a name to this thread. To …

java multithreading executorservice java.util.concurrent
Reason for calling shutdown() on ExecutorService

I was reading about it quite a bit in past couple hours, and I simply cannot see any reason (valid …

java android executorservice
Method call to Future.get() blocks. Is that really desirable?

Please read the question carefully before marking this as duplicate. Below is the snippet of the pseudo code. My question …

java multithreading asynchronous executorservice executor
How to stop all runnable thread in java executor class?

final ExecutorService executor = Executors.newFixedThreadPool(1); final Future<?> future = executor.submit(myRunnable); executor.shutdown(); if(executor.awaitTermination(10, TimeUnit.SECONDS)) { …

java multithreading executorservice
In what cases does Future.get() throw ExecutionException or InterruptedException

My code snippet: ExecutorService executor = Executors.newSingleThreadExecutor(); try { Task t = new Task(response,inputToPass,pTypes,unit.getInstance(),methodName,unit.getUnitKey()); …

java multithreading future executorservice interrupted-exception
Does a Future timeout kill the Thread execution

When using an ExecutorService and Future objects (when submitting Runnable tasks), if I specify a timeout value to the future's …

java concurrency executorservice future
How to use invokeAll() to let all thread pool do their task?

ExecutorService pool=Executors.newFixedThreadPool(7); List<Future<Hotel>> future=new ArrayList<Future<Hotel>>(); …

java multithreading arraylist executorservice future
How to shutdown an ExecutorService?

Whenever I call shutdownNow() or shutdown() it doesn't shut down. I read of a few threads where it said that …

java multithreading executorservice shutdown