Class RunnableFutureTask<R,E extends Exception>
- java.lang.Object
-
- com.google.android.exoplayer2.util.RunnableFutureTask<R,E>
-
- Type Parameters:
R- The type of the result.E- The type of anyExecutionExceptioncause.
- All Implemented Interfaces:
Runnable,Future<R>,RunnableFuture<R>
public abstract class RunnableFutureTask<R,E extends Exception> extends Object implements RunnableFuture<R>
ARunnableFuturethat supports additional uninterruptible operations to query whether execution has started and finished.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRunnableFutureTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidblockUntilFinished()Blocks until the task has finished, or has been canceled without having been started.voidblockUntilStarted()Blocks until the task has started, or has been canceled without having been started.booleancancel(boolean interruptIfRunning)protected voidcancelWork()Cancels any work being done bydoWork().protected abstract RdoWork()Performs the work or computation.Rget()Rget(long timeout, TimeUnit unit)booleanisCancelled()booleanisDone()voidrun()
-
-
-
Method Detail
-
blockUntilStarted
public final void blockUntilStarted()
Blocks until the task has started, or has been canceled without having been started.
-
blockUntilFinished
public final void blockUntilFinished()
Blocks until the task has finished, or has been canceled without having been started.
-
get
public final R get() throws ExecutionException, InterruptedException
- Specified by:
getin interfaceFuture<R>- Throws:
ExecutionExceptionInterruptedException
-
get
public final R get(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException
- Specified by:
getin interfaceFuture<R>- Throws:
ExecutionExceptionInterruptedExceptionTimeoutException
-
cancel
public final boolean cancel(boolean interruptIfRunning)
-
isCancelled
public final boolean isCancelled()
- Specified by:
isCancelledin interfaceFuture<R>
-
run
public final void run()
- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceRunnableFuture<R>
-
cancelWork
protected void cancelWork()
-
-