logo       

How to use Callable instead of Runnable with ScheduledThreadPoolExecutor?: msg#00000

java.jsr.166-concurrency

Subject: How to use Callable instead of Runnable with ScheduledThreadPoolExecutor?

Hello concurrent people,

I have been futzing around with the Java 1.5 concurrent classes for a while now and more or less have the hang of things. But there is one thing I can't figure out. I'd like to schedule a task to execute every x seconds, have it return me a list of Futures for those tasks and, based on the result in each Future, do something.

I'd like to use either scheduleAtFixedRate() or scheduleWithFixedDelay() but both of these take Runnable as their first parameter, and I'd like to use a Callable (to get a Result). I see that schedule() and submit() b oth take Callable as a parameter but that's for a one-shot execution, I need something periodic.

Any way to do this?

Many thanks guys,
Bob
_______________________________________________
Concurrency-interest mailing list
Concurrency-interest@xxxxxxxxxxxxxxxxxxxx
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise