public abstract static class LongAsyncBuilder.BaseLongTask extends java.lang.Object implements LongTask
| Constructor and Description |
|---|
BaseLongTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitPausing()
Pauses the task, which lets the thread finish without completing the task.
|
boolean |
cancel(boolean cancelIfRunnning) |
long |
getLong()
A Type Specific get method that allows to reduce (un)boxing of primtives.
|
long |
getLong(long timeout,
java.util.concurrent.TimeUnit unit)
Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available.
|
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isPaused()
Helper function to detect if the task is currently paused.
|
boolean |
isSuccessful()
Quality of life function that allows to detect if no cancellation/exception was applied to this task and it completed on its own.
|
void |
pause()
Pauses the task, which lets the thread finish without completing the task.
|
void |
resume()
Continues the task if it wasn't already completed.
|
void |
run() |
public void run()
run in interface java.lang.Runnablerun in interface java.util.concurrent.RunnableFuture<java.lang.Long>public boolean cancel(boolean cancelIfRunnning)
cancel in interface java.util.concurrent.Future<java.lang.Long>public long getLong()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
LongTaskpublic long getLong(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
LongTaskgetLong in interface LongTasktimeout - the maximum time to waitunit - the time unit of the timeout argumentjava.lang.InterruptedException - if the current thread was interrupted while waitingjava.util.concurrent.ExecutionException - if the computation threw an exceptionjava.util.concurrent.TimeoutException - if the wait timed outpublic boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<java.lang.Long>public boolean isDone()
isDone in interface java.util.concurrent.Future<java.lang.Long>public boolean isPaused()
LongTaskpublic boolean isSuccessful()
LongTaskisSuccessful in interface LongTaskpublic void pause()
LongTaskpublic void awaitPausing()
LongTaskawaitPausing in interface LongTask