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

public class TimedCallable
extends EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
implements EDU.oswego.cs.dl.util.concurrent.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.


Inner classes inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser.DefaultThreadFactory
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
threadFactory_
 
Constructor Summary
TimedCallable(EDU.oswego.cs.dl.util.concurrent.Callable function, long millis)
           
 
Method Summary
 java.lang.Object call()
           
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
getThreadFactory, setThreadFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedCallable

public TimedCallable(EDU.oswego.cs.dl.util.concurrent.Callable function,
                     long millis)
Method Detail

call

public java.lang.Object call()
                      throws java.lang.Exception
Specified by:
call in interface EDU.oswego.cs.dl.util.concurrent.Callable