Class ExecutorServiceUtil.CallableTaskWrapper<T>
java.lang.Object
org.apache.drill.exec.util.concurrent.ExecutorServiceUtil.CallableTaskWrapper<T>
- Enclosing class:
- ExecutorServiceUtil
public static final class ExecutorServiceUtil.CallableTaskWrapper<T>
extends Object
implements Callable<T>, Future<T>
Executor task wrapper to enhance task cancellation behavior
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncall()
boolean
cancel
(boolean mayInterruptIfRunning) This method will block waiting if the callbale thread is still executing and the "mayInterruptIfRunning" flag is set; this method will return when: The callbale thread is done executing The current thread got interrupted; no exception will be thrown and instead the interrupted flag will be setget()
boolean
boolean
isDone()
void
-
Constructor Details
-
CallableTaskWrapper
CTOR.- Parameters:
callableTask
- original callable task
-
-
Method Details
-
call
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) This method will block waiting if the callbale thread is still executing and the "mayInterruptIfRunning" flag is set; this method will return when:- The callbale thread is done executing
- The current thread got interrupted; no exception will be thrown and instead the interrupted flag will be set
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<T>
-
isDone
public boolean isDone() -
get
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
setFuture
- Parameters:
feature
- the feature to set
-