[concurrency-interest] Is cancel method used anywhere?

mike.kvintus@acterna.com mike.kvintus@acterna.com
Tue, 13 Jul 2004 14:02:20 -0500


This is a multipart message in MIME format.
--=_alternative 0068B64285256ED0_=
Content-Type: text/plain; charset="us-ascii"

I noticed from the Javadocs that the ThreadPoolExecutor.shutdownNow() 
method uses Thread.interrupt to try to stop executing tasks, which implies 
that it will not try the cancel method if the task implements the Future 
interface.  So I was wondering if the cancel method is ever used by any of 
the java.util.concurrent classes.

I need to create a Thread Pool with a limited number of threads which 
queues up tasks to run and can be shutdown in a way that will allow 
running tasks to be cancelled gracefully.  Everything in 
java.util.concurrent seemed to exactly what I needed until I noticed that 
the shutdownNow method does not use the cancel method to stop my tasks 
that will implement the Future interface.  Is there an easy way to do 
this?

Thanks,
--
Mike Kvintus
Acterna
+1 812 961 2057

--=_alternative 0068B64285256ED0_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="sans-serif">I noticed from the Javadocs that the ThreadPoolExecutor.shutdownNow() method uses Thread.interrupt to try to stop executing tasks, which implies that it will not try the cancel method if the task implements the Future interface. &nbsp;So I was wondering if the cancel method is ever used by any of the java.util.concurrent classes.</font>
<br>
<br><font size=2 face="sans-serif">I need to create a Thread Pool with a limited number of threads which queues up tasks to run and can be shutdown in a way that will allow running tasks to be cancelled gracefully. &nbsp;Everything in java.util.concurrent seemed to exactly what I needed until I noticed that the shutdownNow method does not use the cancel method to stop my tasks that will implement the Future interface. &nbsp;Is there an easy way to do this?</font>
<br>
<br><font size=2 face="sans-serif">Thanks,<br>
--<br>
Mike Kvintus<br>
Acterna<br>
+1 812 961 2057<br>
</font>
--=_alternative 0068B64285256ED0_=--