]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils/src/org/simantics/utils/IOperation.java
Changing existing log4j logging to use slf4j
[simantics/platform.git] / bundles / org.simantics.utils / src / org / simantics / utils / IOperation.java
1 package org.simantics.utils;\r
2 \r
3 /**\r
4  * An asynchronous operation returning some result.\r
5  * \r
6  * @author Hannu Niemistö\r
7  */\r
8 public interface IOperation<Result, E extends Exception> {\r
9     /**\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
14      */\r
15     Result waitFor() throws E;\r
16 \r
17     /**\r
18      * Tells whether the operation is already completed.\r
19      */\r
20     boolean isDone();\r
21 \r
22     /**\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
27      */\r
28     void addListener(IOperationListener<Result, E> listener);\r
29 }