Package com.kheops.util
Class TimeoutCommand<T>
java.lang.Object
com.kheops.util.TimeoutCommand<T>
- Type Parameters:
 T- the result type of executionexecute
A command that returns a typed result and may throw an exception.
 Basically wraps around a callable task to monitor execution delay.
 Each task are run on a cached thread pool, will typically improve
 the performance of running many short-lived asynchronous tasks.
- 
Constructor Summary
Constructors - 
Method Summary
 
- 
Constructor Details
- 
TimeoutCommand
public TimeoutCommand() 
 - 
 - 
Method Details
- 
execute
Executes aCallableinterface with a timeout delay. Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.- Parameters:
 task- instructions to be executedtimeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
 - typed result of the callable execution
 - Throws:
 TimeoutException- if the operation is not executed within the configured delay.Exception
 - 
destroy
public void destroy()Gracefully destroy opened resources. 
 -