Modul speiger.src.collections
Klasse CharAsyncBuilder.BaseCharTask
java.lang.Object
speiger.src.collections.chars.utils.CharAsyncBuilder.BaseCharTask
- Alle implementierten Schnittstellen:
Runnable,Future<Character>,RunnableFuture<Character>,CharTask
- Umschließende Klasse:
CharAsyncBuilder
Base Task of the Actions that can be performed.
Allows to simplify the actions that get executed.
-
Verschachtelte Klassen - Übersicht
Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen java.util.concurrent.Future
Future.State -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidPauses the task, which lets the thread finish without completing the task.booleancancel(boolean cancelIfRunnning) chargetChar()A Type Specific get method that allows to reduce (un)boxing of primtives.charWaits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.booleanbooleanisDone()booleanisPaused()Helper function to detect if the task is currently paused.booleanQuality of life function that allows to detect if no cancellation/exception was applied to this task and it completed on its own.voidpause()Pauses the task, which lets the thread finish without completing the task.voidresume()Continues the task if it wasn't already completed.voidrun()Von Klasse geerbte Methoden java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden java.util.concurrent.Future
exceptionNow, resultNow, state
-
Konstruktordetails
-
BaseCharTask
public BaseCharTask()
-
-
Methodendetails
-
run
public void run()- Angegeben von:
runin SchnittstelleRunnable- Angegeben von:
runin SchnittstelleRunnableFuture<Character>
-
cancel
public boolean cancel(boolean cancelIfRunnning) -
getChar
Beschreibung aus Schnittstelle kopiert:CharTaskA Type Specific get method that allows to reduce (un)boxing of primtives. Waits if necessary for the computation to complete, and then retrieves its result.- Angegeben von:
getCharin SchnittstelleCharTask- Gibt zurück:
- the computed result as primitive
- Löst aus:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if the computation threw an exception
-
getChar
public char getChar(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Beschreibung aus Schnittstelle kopiert:CharTaskWaits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.- Angegeben von:
getCharin SchnittstelleCharTask- Parameter:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Gibt zurück:
- the computed result as primitive
- Löst aus:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if the computation threw an exceptionTimeoutException- if the wait timed out
-
isCancelled
public boolean isCancelled()- Angegeben von:
isCancelledin SchnittstelleFuture<Character>
-
isDone
public boolean isDone() -
isPaused
public boolean isPaused()Beschreibung aus Schnittstelle kopiert:CharTaskHelper function to detect if the task is currently paused. -
isSuccessful
public boolean isSuccessful()Beschreibung aus Schnittstelle kopiert:CharTaskQuality of life function that allows to detect if no cancellation/exception was applied to this task and it completed on its own.- Angegeben von:
isSuccessfulin SchnittstelleCharTask- Gibt zurück:
- true if it was properly completed
-
pause
public void pause()Beschreibung aus Schnittstelle kopiert:CharTaskPauses the task, which lets the thread finish without completing the task. Tasks are written in the way where they can pause without any issues. This won't be instant, as this function is applied asynchronous and doesn't check if the thread paused. So make sure it had the time to pause. -
awaitPausing
public void awaitPausing()Beschreibung aus Schnittstelle kopiert:CharTaskPauses the task, which lets the thread finish without completing the task. Tasks are written in the way where they can pause without any issues. This won't be instant, as this function is applied asynchronous. It will await the pausing of the task.- Angegeben von:
awaitPausingin SchnittstelleCharTask
-
resume
public void resume()Beschreibung aus Schnittstelle kopiert:CharTaskContinues the task if it wasn't already completed. This is done by resubmitting the task to the executor provided.
-