*
The moose likes Threads and Synchronization and the fly likes How to get running thread from SchedulerThreadPoolExecutor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "How to get running thread from SchedulerThreadPoolExecutor" Watch "How to get running thread from SchedulerThreadPoolExecutor" New topic
Author

How to get running thread from SchedulerThreadPoolExecutor

Tim Lim
Greenhorn

Joined: Oct 14, 2010
Posts: 22
Hi all, I have some problems using SchedulerThreadPoolExecutor.

I wanted to get the Example class implement Runnable. Below is the code snippet


From the API documentation, I can see that there is this getQueue() method that will get BlockingQueue<Runnable>. However, when I try to run through a loop for the BlockingQueue,
I have found that the Runnable contains an instance of ScheduledFutureTask. I could not find a way to get the Example class that I implemented. In addition, I don't see a method that will return a list of running task. So my question are:

1) Is there a way to get Example class that I implemented from the scheduler?
2) Is there a way to keep track of the running task since getQueue() return a list of runnable which are not running?
3) I wanted to implement a code that will stop a task in the event if all 3 attempts of retry failed. So how should I do it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get running thread from SchedulerThreadPoolExecutor