--- /dev/null
+package org.simantics.utils;\r
+\r
+/**\r
+ * An asynchronous operation returning some result.\r
+ * \r
+ * @author Hannu Niemistö\r
+ */\r
+public interface IOperation<Result, E extends Exception> {\r
+ /**\r
+ * Waits that operation is completed. Either returns the\r
+ * result or throws an exception if the operation fails.\r
+ * If operation has already been completed when the method is called,\r
+ * returns immediately.\r
+ */\r
+ Result waitFor() throws E;\r
+\r
+ /**\r
+ * Tells whether the operation is already completed.\r
+ */\r
+ boolean isDone();\r
+\r
+ /**\r
+ * Adds a listener that is notified when the operation\r
+ * is completed. If the operation has already been completed\r
+ * when the method is called, calls the listener immediately\r
+ * (but asynchronously).\r
+ */\r
+ void addListener(IOperationListener<Result, E> listener);\r
+}
\ No newline at end of file