Schnittstelle ObjectTask<T>

Typparameter:
T - the keyType of elements maintained by this Collection
Alle Superschnittstellen:
Future<T>, Runnable, RunnableFuture<T>
Alle bekannten Implementierungsklassen:
ObjectAsyncBuilder.BaseObjectTask

public interface ObjectTask<T> extends RunnableFuture<T>
A Type Specific Task interface that allows you to keep track of the task that is currently running.
It extends Runnable future and supports said functions but also provides quality of life functions like:
- isSuccesfull: which allows to detect if the task was completed properly and not interrupted or crashed. - pause/resume: which allows to pause/resume the task at any moment, making it easier to create thread-safe actions.
  • Verschachtelte Klassen - Übersicht

    Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen java.util.concurrent.Future

    Future.State
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    Pauses the task, which lets the thread finish without completing the task.
    boolean
    Helper function to detect if the task is currently paused.
    boolean
    Quality of life function that allows to detect if no cancellation/exception was applied to this task and it completed on its own.
    void
    Pauses the task, which lets the thread finish without completing the task.
    void
    Continues the task if it wasn't already completed.

    Von Schnittstelle geerbte Methoden java.util.concurrent.Future

    cancel, exceptionNow, get, get, isCancelled, isDone, resultNow, state

    Von Schnittstelle geerbte Methoden java.util.concurrent.RunnableFuture

    run
  • Methodendetails

    • isPaused

      boolean isPaused()
      Helper function to detect if the task is currently paused.
      Gibt zurück:
      true if paused
    • pause

      void pause()
      Pauses 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

      void awaitPausing()
      Pauses 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.
    • resume

      void resume()
      Continues the task if it wasn't already completed. This is done by resubmitting the task to the executor provided.
    • isSuccessful

      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.
      Gibt zurück:
      true if it was properly completed