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
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall()booleancancel(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()booleanbooleanisDone()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:
isCancelledin interfaceFuture<T>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<T>- Throws:
InterruptedExceptionExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<T>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
setFuture
- Parameters:
feature- the feature to set
-