Interface Work

  • All Superinterfaces:
    SubmittableWork

    public interface Work
    extends SubmittableWork
    An interface implemented by the Comm Framework to publicly express units of work that are being managed by the framework.

    Author:
    Todd S. Murchison
    • Method Detail

      • getState

        Work.Status getState()
        Returns the current state of this Work instance
      • get

        Response get​(long timeout,
                     TimeUnit unit)
              throws InterruptedException,
                     ExecutionException,
                     TimeoutException
        Waits if necessary for the computation to complete, and then retrieves its result. The given timeout is a hint and may only be approximately honored depending on implementation.

        Parameters:
        timeout - A timeout hint that may only be approximately honored depending on implementation.
        unit - The time unit of the timeout argument.
        Returns:
        The computed result.
        Throws:
        InterruptedException - If the current thread was interrupted while waiting.
        ExecutionException - If the computation threw an exception.
        TimeoutException - If the wait timed out.
      • getException

        Exception getException()
        Returns an Exception instance that is relevant to this Work instance, or null if there is none. If this work fails without a Response this can be used to understand why (socket timeout, etc.).
      • isDone

        boolean isDone()
        Returns true if this work completed. Completion may be due to normal termination, an exception, or cancellation. In all of these cases, this method will return true.
      • isCancelled

        boolean isCancelled()
        Returns true if this work was cancelled before it completed normally.