This is probably a simple one, but I've tried loads of different things and no matter what I try, I can't get this to work.
Basically I have a JProgressBar that I want to update as I process the task list. The tasks are quite short, but there is a lot of them which is why I used an ExecutorService.
The problem is that I can't find a good way to listen to the ExecutorService for how many tasks are left to process. invokeAll() blocks until all the tasks are complete an if I use submit() to execute each task, the tasks are pretty much done by the time it hits the code for the JProgressBar. I even tried interleaving the two but that was just nasty.
Is there an easy way to submit a batch of tasks (implementing callable), then call an execute() method which starts processing in?
Or am I looking in completely the wrong direction here?
Thanks!