This content has been marked as final. Show 4 replies
968970 wrote:you don't implement invokeAll(), ThreadPoolExecutor does. it is just a shorthand method for submitting all your tasks if you already have them in a Collection.
I am thinking to use ThreadPoolExecutor and will create specific task for my utility program. But i am confused that should i first create a list of all my task having my account and invoke the method invokeAll(taskList). And in invokeAll Should I loop through all my accounts and invoke the run method on the Callable task.
however, that's most likely not how you want to do it. you should submit each account task as you create it so that some of the tasks can be running while you are still finding more accounts.
Also, i want to know that how can i find out that actually my program is multithreaded and its behaving in the same manner?if you want to go low tech, you can print out progress info from each task and see that they are running in parallel. or, you could attach a profiler to the java process and watch the threads in action.
i would also suggest reading some of the many excellent multi-threading tutorials out there to make sure you are good on the basics.
I am having lacks of account and so reading the account one by one will give me a performance hit. So I am not getting how to go about it. Also, i am not getting how can i do connection pooling in a standalone program. I am not gonna deploy this on any server.It will run as a batch process.Please help me.