Questions tagged [completion-service]
30 questions
86
votes
12 answers
When should I use a CompletionService over an ExecutorService?
I just found CompletionService in this blog post. However, this does't really showcases the advantages of CompletionService over a standard ExecutorService. The same code can be written with either. So, when is a CompletionService useful?
Can you…

ripper234
- 222,824
- 274
- 634
- 905
6
votes
2 answers
Is there a way to use ScheduledExecutorService with ExecutorCompletionService?
I'm trying to use ExecutorCompletionService and ScheduledExecutorService together.
What I need to do is schedule disparate activities that each have "delays before execution" and then "reschedule them" (which different delays) based upon the result…

JalapenoGremlin
- 133
- 6
5
votes
2 answers
Spring equivalent of CompletionService?
In my app I have to process multiple jobs asynchronously from the main application thread and collect the result of each job. I have a plain Java solution that does this using a ExecutorService and a ExecutorCompletionService that collects the job…

Julius
- 2,784
- 6
- 32
- 54
4
votes
3 answers
OutOfMemory error with FixedThreadPool and ExecutorCompletionService
I working on app what should get list of users from db and update thie details from directory (ldap or AD). I what do this procedure on multicore machine so I created this app (code below). I'm using CompletionService and getting the results in…

Vik Gamov
- 5,446
- 1
- 26
- 46
3
votes
1 answer
Retry policy in CompletionService
I need to configure retry policy for calling an API via ExecutorCompletionService.
Sample Code:
public void func() throws Exception{
ExecutorService executorService = Executors.newFixedThreadPool(5);
CompletionService…

syfro
- 121
- 1
- 5
2
votes
1 answer
How to know which callable finished upon pool method in CompletionService in java
Let say you are writing a code like following:
CompletionService completion = new ExecutorCompletionService<>(new ExecutorService());
for(Callable callable : callableList) {
completion.submit(callable);
}
// Do something else
while(true)…

jaeyong
- 8,951
- 14
- 50
- 63
2
votes
1 answer
Check cancelled tasks through CompletionService
I am investigating the CompletionService class, and I find really useful the decoupling of the submitting queue from the completition queue.
But I miss a way to poll/take cancelled tasks as well (which could be considered completed in a way). Can it…

Whimusical
- 6,401
- 11
- 62
- 105
2
votes
1 answer
PriorityExecutor with ExecutorCompletionService, is it possible?
I have implemented an PriorityExecutor based on
http://funofprograming.blogspot.co.il/2013/11/priorityexecutorservice-for-java.html
and
Specify task order execution in Java
However I want to use an ExecutorCompletionService and hand it the…

Dudi
- 2,340
- 1
- 24
- 39
2
votes
2 answers
Processing a large number of tasks with CompletionService
I need to process a large number (>100 million) of requests on a multi-core machine (each request is to process a row in a data file and involves some I/O with a remote system. Although the details do not matter much, the specific task is to load a…

wishihadabettername
- 14,231
- 21
- 68
- 85
2
votes
1 answer
Wait for completion of several jobs in Hadoop
I need to submit several jobs, which will use same input folder but produce different results in different output folders. These jobs should run in parallel and don't depend on each other.
Is there any simple way to wait for completion of all these…

jdevelop
- 12,176
- 10
- 56
- 112
1
vote
1 answer
In Java cannot identify out when multiple producer/consumer has completed
Have a multiple producer consumer pattern producer1 - > consumer1/producer2 -> consumer2/producer 3, each producer uses a completion service but Im having problems coding the logic for working out when it has finsihed.
The problem is that main puts…

Paul Taylor
- 13,411
- 42
- 184
- 351
1
vote
1 answer
Java using ExecutorService,CompletionService,BlockingQueue,and Observer correctly?
So, I'm pretty new to multi-threading and have been using this idea in all my programs lately. Before I start using it more I really want to make sure it is a correct efficient way to implement multi-threading using the Executor,CompletionService…

steve
- 297
- 1
- 5
- 17
1
vote
1 answer
Multiple CompletionService for one thread pool Java
I'm working on a Java server application with the general following architecture:
Clients make RPC requests to the server
The RPC server (gRPC) I believe has its own thread pool for handling requests
Requests are immediately inserted into Thread…

widavies
- 774
- 2
- 9
- 22
1
vote
0 answers
Implementing custom Executor
In the example below if I implement ExecutorImpl without using Thread, then taskCompletionService.submit is blocked, even though it returns Future.
Is it possible to not block submit, but not use Thread in ExecutorImpl?
class ExecutorServiceTest {
…

Vardan Hovhannisyan
- 1,101
- 3
- 17
- 40
1
vote
1 answer
How to use mock on ExecutorCompletionService
I am using ExecutorCompletionService and below method calls from that
Future
- > studentDetails = taskCompletionService.take();
Lis

Bravo
- 8,589
- 14
- 48
- 85