Class CallableDeferredNode

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Runnable getRunnable() Returns the underlying task.
      Unit handleError(Exception exception) Handles the error in this DeferredNode.
      Boolean isCompleted() Return whether this DeferredNode is completed.
      T call() Computes a result.
      abstract T apply() Override this method to perform a computation on a background thread.
      final T get() Waits If necessary for the computation to complete, and then retrieves its result.
      final T get(Long timeout, TimeUnit unit) Waits if necessary for at most the given time for the computation to complete, and then retrieves its result.
      abstract Unit onResponse(T response) Runs on the UI thread after apply.
      abstract Unit onFailure(Exception exception) Runs on the UI thread after apply.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • call

         T call()

        Computes a result.

        Returns:

        the computed result.

      • apply

         abstract T apply()

        Override this method to perform a computation on a background thread.

        Returns:

        the computed result.

      • get

         final T get()

        Waits If necessary for the computation to complete, and then retrieves its result.

        Returns:

        the computed result.

      • get

         final T get(Long timeout, TimeUnit unit)

        Waits if necessary for at most the given time for the computation to complete, and then retrieves its result.

        Parameters:
        timeout - time to wait before cancelling the operation.
        unit - the time unit for the timeout.
        Returns:

        the computed result.

      • onResponse

        @UiThread() abstract Unit onResponse(T response)

        Runs on the UI thread after apply. The specified result is the value returned by apply.

        This method won't be invoked if the deferred was canceled or an error occurred.

        Parameters:
        response - the response of the operation computed by apply.