Back Forum Reply New

best approach for multiple asynchnorous process

Guys,
my project needs to handle mutliple processes asynchronously for generating reports.
So i dont want to use activemq coz it doesnt solve the purpose for parallel process. I am thinking about quartz process. which i want to create quartz process on demand. So if i have 10 report requests i have to create 10 jobs to process the request once the job is done it should die.
and i should be able to identify  how many jobs are running.
so can i achieve  with quartz ? if so how can  i do that..

Let me know if this is the good way or any other best approach.

i appreciate any suggestions.

Maybe you could have a look at the following blogpost:

2007/...-task-from-ui/

And by setting the poolsize of the executor to 10, you are able to create 10 reports in parallel max.

Thanks Alarmnummer.
Most of my jobs runs longer time. so i want to restrict the no of threads max to 10 or 20. first all the requests are stored in the db. based on FiFO(date) i process the first 10/20 records asynchronsly. we have clustered environment. So
across i need to make sure no of threads before processing new thread.

Let me try your suggested blog. Thanks for quick reponse.

i could able to run threads parallely in different servers..

The issue i came through is monitering the threads.

i did see method getActiveCount()  for no of executing tasks..

but it looks inconsistent... i am not getting the correct count..

so do we have any other method for knowing the no of active threads executing  tasks  ?

any suggestions would be appreciated

You could create something yourself. If you decorate the original Runnable with a CountingRunnable, you will have an indication of the number of active threads. But I can't imagine why the current implementation fails.eg:

Code:
private AtomicLong count = new AtomicLong();

class CountingRunnable implements Runnable{   Runnable target;
  public void run(){      count.inc();      try{   target.run();      }finally{          count.dec();      }  }
}Thanks for the suggestion...it helps lot..
¥
Back Forum Reply New