1 package org.simantics.utils;
\r
4 * An asynchronous operation returning some result.
\r
6 * @author Hannu Niemistö
\r
8 public interface IOperation<Result, E extends Exception> {
\r
10 * Waits that operation is completed. Either returns the
\r
11 * result or throws an exception if the operation fails.
\r
12 * If operation has already been completed when the method is called,
\r
13 * returns immediately.
\r
15 Result waitFor() throws E;
\r
18 * Tells whether the operation is already completed.
\r
23 * Adds a listener that is notified when the operation
\r
24 * is completed. If the operation has already been completed
\r
25 * when the method is called, calls the listener immediately
\r
26 * (but asynchronously).
\r
28 void addListener(IOperationListener<Result, E> listener);
\r