File tree 1 file changed +23
-0
lines changed
openmessaging-api/src/main/java/io/openmessaging
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 32
32
* @since OMS 1.0.0
33
33
*/
34
34
public interface Future <V > {
35
+ /**
36
+ * Attempts to cancel execution of this task. This attempt will
37
+ * fail if the task has already completed, has already been cancelled,
38
+ * or could not be cancelled for some other reason. If successful,
39
+ * and this task has not started when {@code cancel} is called,
40
+ * this task should never run. If the task has already started,
41
+ * then the {@code mayInterruptIfRunning} parameter determines
42
+ * whether the thread executing this task should be interrupted in
43
+ * an attempt to stop the task.
44
+ *
45
+ * <p>After this method returns, subsequent calls to {@link #isDone} will
46
+ * always return {@code true}. Subsequent calls to {@link #isCancelled}
47
+ * will always return {@code true} if this method returned {@code true}.
48
+ *
49
+ * @param mayInterruptIfRunning {@code true} if the thread executing this
50
+ * task should be interrupted; otherwise, in-progress tasks are allowed
51
+ * to complete
52
+ * @return {@code false} if the task could not be cancelled,
53
+ * typically because it has already completed normally;
54
+ * {@code true} otherwise
55
+ */
56
+ boolean cancel (boolean mayInterruptIfRunning );
57
+
35
58
/**
36
59
* Returns {@code true} if this task was cancelled before it completed normally.
37
60
*
You can’t perform that action at this time.
0 commit comments