Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
322 views

How to handle multiple return types using Future and executer's invokeAll in Java8?

How to handle multiple return types in future.get when invokeall is called? List<Future<List<Object>>> futureListe = executor.invokeAll(Classableobjekts); //Objekts list contain two ...
fatherazrael's user avatar
  • 5,927
0 votes
1 answer
904 views

Java Executor to execute one Callable after previous has finished? [closed]

I have a custom business requirement. I need to execute a series of service calls. Each of these call creates a new record in the database. I need to execute the next service call only after the ...
SPS's user avatar
  • 303
5 votes
1 answer
2k views

Keep track of tasks submitted to ThreadPoolExecutor

I am running several tasks in a ThreadPoolExecutor. I initialise it as follows: private VideoExportExecutor executor; private BlockingQueue<Runnable> jobQueue; public void ...
tishu's user avatar
  • 1,008
5 votes
4 answers
6k views

How to get to FutureTask execution state?

I have a singleThreadExecutor in order to execute the tasks I submit to it in serial order i.e. one task after another, no parallel execution. I have runnable which goes something like this ...
Svilen's user avatar
  • 1,437
9 votes
4 answers
8k views

How to ensure garbage collection of a FutureTask that is submitted to a ThreadPoolExecutor and then cancelled?

I am submitting Callable objects to a ThreadPoolExecutor and they seem to be sticking around in memory. Looking at the heap dump with the MAT tool for Eclipse see that the Callable objects are being ...
cottonBallPaws's user avatar
26 votes
7 answers
25k views

How to implement PriorityBlockingQueue with ThreadPoolExecutor and custom tasks

I've searched a lot but could not find a solutuion to my problem. I have my own class, BaseTask, that uses a ThreadPoolExecutor to handle tasks. I want task prioritization, but when I try to use a ...
mariusgreve's user avatar
  • 2,651
2 votes
1 answer
1k views

how do FutureTasks and CachedThreadPool work

I currently have code that does the following: private final static ExecutorService pool = Executors.newCachedThreadPool(); public void foo(){ FutureTask<MyObject> first_task = ...
Aly's user avatar
  • 16.2k