Colt 1.0.2

edu.oswego.cs.dl.util.concurrent
Class TimedCallable

java.lang.Object
  |
  +--edu.oswego.cs.dl.util.concurrent.ThreadFactoryUser
        |
        +--edu.oswego.cs.dl.util.concurrent.TimedCallable
All Implemented Interfaces:
Callable

public class TimedCallable
extends ThreadFactoryUser
implements Callable

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.


Constructor Summary
TimedCallable(Callable function, long millis)
           
 
Method Summary
 Object call()
          Perform some action that returns a result or throws an exception
 
Methods inherited from class edu.oswego.cs.dl.util.concurrent.ThreadFactoryUser
getThreadFactory, setThreadFactory
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedCallable

public TimedCallable(Callable function,
                     long millis)
Method Detail

call

public Object call()
            throws Exception
Description copied from interface: Callable
Perform some action that returns a result or throws an exception
Specified by:
call in interface Callable

Colt 1.0.2

Submit a bug or feature. Check the Colt home page for the latest news.