java - Tracking Completed Tasks in ExecutorService -


i'm writing application in java uses executorservice running multiple threads.

i wish submit multiple tasks (thousands @ time) executor callables , when done, retrieve result. way i'm approaching each time call submit() function, future store in arraylist. later pass list thread keeps iterating on it, calling future.get() function timeout see if task completed. right approach or inefficient?

edit --- more info --- problem each callable takes different amount of processing time. if take first element out of list , call get() on it, block while results of others may become available , program not know. why need keep iterating timeouts.

thanks in advance

note call future.get block until answer available. don't need thread iterate on array list.

see here https://blogs.oracle.com/corejavatechtips/entry/get_netbeans_6


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -