EDU.oswego.cs.dl.util.concurrent
Class TimedCallable
- Callable
public class TimedCallable
TimedCallable runs a Callable function for a given length of time.
The function is run in its own thread. If the function completes
in time, its result is returned; otherwise the thread is interrupted
and an InterruptedException is thrown.
Note: TimedCallable will always return within the given time limit
(modulo timer inaccuracies), but whether or not the worker thread
stops in a timely fashion depends on the interrupt handling in the
Callable function's implementation.
Version:
- Joseph Bowbeer
TimedCallable
public TimedCallable(Callable function,
long millis)
call
public Object call()
throws Exception
- call in interface Callable