Interface AsyncTask


public interface AsyncTask
An instance of this interface encapsulates a task to perform asynchronously.
Author:
Mackenzie High
  • Method Summary

    Modifier and Type
    Method
    Description
    TODO: wrong functor type This method retrieves the action that will be performed by this task.
    void
    after(Action functor)
    This method binds an action hereto to perform after completion of the task.
    boolean
    This method tries to cancel this task.
    This method creates an exact copy of this object.
    void
    error(Action functor)
    This method binds an action hereto to perform after an error.
    boolean
    This method determines whether this task was canceled.
    boolean
    This method determines whether the task has finished running yet.
    boolean
    This method determines whether this task is currently running.
    result(boolean block)
    This method attempts to retrieve the result of this task.
    void
    run()
    This method makes this task runnable and then immediately returns.
  • Method Details

    • copy

      AsyncTask copy()
      This method creates an exact copy of this object.
      Returns:
      a copy of this object.
    • action

      Action action()
      TODO: wrong functor type This method retrieves the action that will be performed by this task.
      Returns:
      the underlying action that will be performed asynchronously.
    • run

      void run()
      This method makes this task runnable and then immediately returns.

      This task may not be executed immediately. Instead, this task will be executed when a thread becomes available for it. Thus, the return of this method does not imply that the task has completed.

      Throws:
      IllegalStateException - if this method was already invoked.
    • cancel

      boolean cancel()
      This method tries to cancel this task.
      Returns:
      true, iff this task was successfully canceled due to this invocation.
    • isCanceled

      boolean isCanceled()
      This method determines whether this task was canceled.
      Returns:
      true, iff this task was successfully canceled.
    • isRunning

      boolean isRunning()
      This method determines whether this task is currently running.
      Returns:
      true, iff this task is currently running.
    • isFinished

      boolean isFinished()
      This method determines whether the task has finished running yet.
      Returns:
      true, iff the task has finished running.
    • result

      Object result(boolean block)
      This method attempts to retrieve the result of this task.
      Parameters:
      block - is true, iff this method must block until the task completes.
      Returns:
      the result of successfully completing the task; otherwise, return null.
    • after

      void after(Action functor)
      This method binds an action hereto to perform after completion of the task.
      Parameters:
      functor - is an action to perform after the task finishes.
      Throws:
      NullPointerException - if functor is null.
    • error

      void error(Action functor)
      This method binds an action hereto to perform after an error.
      Parameters:
      functor - is an action to perform, if the task cannot finish due to an exception.
      Throws:
      NullPointerException - if functor is null.