Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Parallelism/ExecutorService in J2EE environment  RSS feed

 
Debopam Poddar
Ranch Hand
Posts: 51
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to develop one process that will process fast. Below is my requirement and my thoughts

This process executes 10 different queries. To have the performance better I will create ThreadPool using assign independent queries as task and attach with ExecutorService. Then submit the task. I will do it within a stateless session bean. Please let me know whether this approach is correct or not. The machine I am running is dual processor quad core machine with 2G Ram.

I would also like to do/start the processing immediately after results from query are available (doesn't want to wait till all the results are available). Please let me know how to achieve this.

 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up

work manager

and see if your container supports it yet.

Your not supposed to create your own threads in J2EE (you can off course) , the idea is you submit tasks to a work manager that is integrated in the container, makes thread management a lot easier going forward.

I guess if you are doing something really complex and need the advantages of say Java 7 fork / join doing the threading yourself may be preferable but your losing some of the advantages of J2EE.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!