[concurrency-interest] ScheduledThreadPoolExecutor and stalled jobs

Harsha Nagesh harshanagesh at yahoo.com
Tue Nov 14 20:45:33 EST 2006


     I am trying to use ScheduledThreadPoolExecutor to schedule a bunch of
jobs, each of which should be scheduled every minute. I am running this on win
XP and using a poolsize = 20 (threads). However, what I see is that out of the
100 or so jobs that have been added to the scheduler, there is a subset of them
(more than 20%) which seem to be scheduled once and never again after the first
time. I am not sure how to go about debugging this issue. Any pointers will be
greatly appreciated. Here is the skeleton of code that shows the way I am using
the scheduler and I am not sure if this is the best way to achieve my objective

int poolSize = 20;
long period = 60; //1 minute
long delay = 60; //1 minute
TimeUnit timeUnit = TimeUnit.SECONDS;

ScheduledThreadPoolExecutor pool = new 
for(int i = 0; i < 100; i++){
   MyTask task = new MyTask();

I also tried to use 


instead of the fixedRate scheduling, but I found the same behavior and many of
my jobs were stuck and not executed after the first run.

Any ideas ?


Yahoo! Music Unlimited
Access over 1 million songs.

More information about the Concurrency-interest mailing list