Questions tagged [invokeall]

7 questions
2
votes
2 answers

Does invokeAll() stop the main Thread?

I'm wondering if the main thread waits until all tasks in invokeAll() parameter finish before it continues. Here's my code and it seems that it does. public static void main(String[] args) throws InterruptedException { ExecutorService service =…
Tran Anh Minh
  • 196
  • 2
  • 12
2
votes
2 answers

Why should we call join after invokeAll method?

I am trying to learn about the ForkJoinPool framework and came across the below example: public class ArrayCounter extends RecursiveTask { int[] array; int threshold = 100_000; int start; int end; public ArrayCounter(int[] array, int…
ghostrider
  • 2,046
  • 3
  • 23
  • 46
1
vote
1 answer

Facing issue while using invokeAll to fetch Future object in ExecutorService

Facing below error while fetching Future object by using invokeAll Method. Iam trying to implement ExecutorService to call parallelly. ERROR>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>java.util.concurrent.ExecutionException:…
Monojit
  • 157
  • 1
  • 15
1
vote
1 answer

How can I fix callable overlapping in Java?

I'm not sure whether the title is detail/correct or not but i can't figure out how to describe it in the title so I will try my best to describe it here I've been trying to use callable in Java for concurrency, but the outcome is not correct, seem…
Zero
  • 35
  • 5
1
vote
2 answers

mocking ExecutorService invokeAll method in java

I am trying to mock the ExecutorService but it is constantly giving compile error. The code that I am trying is the following: ExecutorService executorService = mock(ExecutorService.class); Future mockedFuture =…
jaeyong
  • 8,951
  • 14
  • 50
  • 63
0
votes
1 answer

java.util.ConcurrentModificationException when combing results from Future's into HashMap

I'm running into an issue where I intermittently get an java.util.ConcurrentModificationException error whilst merging the results of futures. I've tried making all my HashMaps concurrent and I tried using an iterator but the error still persists…
JoshB
  • 3
  • 1
0
votes
0 answers

ExecutorService InvokeAll for hybrid datatype

I am new trying to invoke multiple multiple threads with varied return types, using ExecutorService. I need to wait for all threads to complete, before I proceed. I am able to do it using homogeneous return types, but want to use heterogeneous…
Saurabh Jhunjhunwala
  • 2,832
  • 3
  • 29
  • 57