General J2EE: Creating Threads via JMX
I want to create an defined amount of threads to parallelize a greater job. The job is submitted via JMX to my Application.
My managementtool will call a JMX MBean to trigger a masterjob. This job will be splitted in subjobs, which I want to create with threads to get all my CPU/Cores (at least 8 cores and therefore at least 8 threads) to process massively parallel the masterjob.
The masterjob, and therefore the subjobs must be interuptable and the masterjob must be monitorable, to report the finished percentage of the masterjob.
I have an J2EE 1.4 AppServer and I'm able to use JDK1.5/5.0.
Maybe a J2EE 5.0 AppServer would be possible if the AppServer will be available until the end of this year.
Is there any Pattern available to process such request?
My ideas are:
- create x URLConnections and trigger x Servlets/Actions to process the request (not fine, because of creating networkconnection to the same appserver). But how to interupt the job and how to monitor it?
- create x JMS messages and trigger x MDBs to parallelize the job. (not fine, because of creating networkconnection to the same appserver). But how to interupt the jobs and how to monitor it?
- JMX creates the needed amount of Threads e.g. stateless SessionBean, MDB to parallelize the job. But how to split of the Beans? and how to monitor and interupt the jobs?
If there is no pattern available for J2EE is there any other available, which could run in an J2EE AppServer?
Is there any JSR, which addresses the asynchronity problem in an J2EE AppServer?
From my point of view, it is an standard problem, there I have an synchron client call to the servlet/EJB and, therein I have to fork a managed thread to process something asynchronously.
really nobody with same issues/problems?
please help! ;-(
I suggest you use the right tools for the job.
I am using Quartz for parrell processing "jobs", the quartzScheduler manages each( use JDBC Quartz For J2EE)..i would use simply RAMJobs because u just need 8 jobs running conncurrently checking CPU/Core information...in quartz u can set to only allow max 8 jobs, and threadporioty..
Don't know if you would need a master job, in quartz you will just assigned "Triggers" via Cron experision to fire all 8 jobs concurrently say every 10 minutes.
If your server is accessing outside URLs from your server..
you should use a Apache's HttpClient..instead of URLConnection..
After you do all this ONLY use JMX to monitor/manage the quartz scheduler(deletes,starts,manages jobs,etc..)..
I use to use EJBs/MDB,etc alot 2 years ago...but now Spring/Hibernate/Quartz,etc which i could provide the same solutions and develop/design it in half the time..im not a spring lap-dog!! But i feel your pain from your question cause i've been there.