Package net.toddm.comm
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWork.StatusAn set of possible states that work can be in
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Responseget()Waits if necessary for the computation to complete, and then retrieves its result.Responseget(long timeout, TimeUnit unit)Waits if necessary for the computation to complete, and then retrieves its result.ExceptiongetException()Work.StatusgetState()Returns the current state of thisWorkinstancebooleanisCancelled()Returns true if this work was cancelled before it completed normally.booleanisDone()Returns true if this work completed.-
Methods inherited from interface net.toddm.comm.SubmittableWork
getCachingBehavior, getCachingPriority, getId, getRequest, getRequestPriority, setDependentWork
-
-
-
-
Method Detail
-
getState
Work.Status getState()
Returns the current state of thisWorkinstance
-
get
Response get() throws InterruptedException, ExecutionException
Waits if necessary for the computation to complete, and then retrieves its result.- Returns:
- The computed result.
- Throws:
InterruptedException- If the current thread was interrupted while waiting.ExecutionException- If the computation threw an exception.
-
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()
-
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.
-
-