|
Re: Best way to remove a scheduled task with ScheduledThreadPoolExecutor: msg#00010java.jsr.166-concurrency
After cancel() you *can* call STPE.purge() to remove it ASAP. But this is probably not necessary unless you're wasting lots and lots of tasks. On 10/10/06, Holger Hoffstätte <holger@xxxxxxxxxx> wrote: > Robert Bowen wrote: > > I am using a ScheduledThreadPoolExecutor to schedule Runnable tasks. I > > would like to be able to remove tasks as well. I see in the API that > > ScheduledThreadPoolExecutor has a remove() method which takes a Runnable > > as a parameter. Fantastic! How do I tell it which Runnable I want to remove? > > You cannot - that method does not work as expected and contains an > internal bug that got fixed in Mustang b71. Check the mailing list > archives from around last December/January, there was a fairly long > discussion about this. Summary: just use cancel() on your returned Futures > - this will let the tasks drop out of the queue eventually. > > Holger >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Best way to remove a scheduled task with ScheduledThreadPoolExecutor, Holger Hoffstätte |
|---|---|
| Next by Date: | Re: Best way to remove a scheduled task with ScheduledThreadPoolExecutor, Robert Bowen |
| Previous by Thread: | Re: Best way to remove a scheduled task with ScheduledThreadPoolExecutor, Holger Hoffstätte |
| Next by Thread: | Re: Best way to remove a scheduled task with ScheduledThreadPoolExecutor, Robert Bowen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |