-
Feb 20th, 2013, 02:36 PM
#1
Controlling the execution of multi-threaded tasks
We are converting some jobs to use Spring Batch. Currently we have several multi-threaded jobs that are utilizing an ExecutorService. However, to avoid allowing too many threads and jobs running in parallel, we have a class that controls how many ExcecutorServices are allowed to be in use at a time. Each job gets it's own Executorservice, or if none are available, it waits until a job is done. When the job is done, it returns it's executorservice to the pool.
Is there a way to do this with SpringBatch? The current model appears to only allow 1 executorService for all jobs, or each job could have it's own, but they all could get used at the same time causing resource/memory consumption issues. I'm thinking about using factory to hand out the executorservice objects, but I'm not sure if that will work yet. I need a way to detect when the executorservice is done being used by the job, so I can then allow another one to be used. Thoughts?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules