[concurrency-interest] ScheduledThreadPoolExecutor and stalled jobs

David Holmes dcholmes at optusnet.com.au
Tue Nov 14 22:49:31 EST 2006


Harsha,

You skeleton is right - the key question is : what does a MyTask try to do?
Do they block for anything?

David Holmes

> -----Original Message-----
> From: concurrency-interest-bounces at cs.oswego.edu
> [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Harsha
> Nagesh
> Sent: Wednesday, 15 November 2006 11:46 AM
> To: concurrency-interest at cs.oswego.edu
> Subject: [concurrency-interest] ScheduledThreadPoolExecutor and stalled
> jobs
>
>
> Hi,
>
>      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
>           ScheduledThreadPoolExecutor(poolSize);
> for(int i = 0; i < 100; i++){
>    MyTask task = new MyTask();
>    pool.scheduleAtFixedRate(task,0,period,timeUnit);
> }
>
> I also tried to use
>
> pool.scheduleWithFixedDelay(task,0,delay,timeUnit);
>
> 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 ?
>
> Thanks,
> Harsha
>
>
>
>
> __________________________________________________________________
> __________________
> Yahoo! Music Unlimited
> Access over 1 million songs.
> http://music.yahoo.com/unlimited
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest



More information about the Concurrency-interest mailing list