1 package org.apache.commons.javaflow;
2
3 import org.apache.commons.javaflow.bytecode.StackRecorder;
4
5 /**
6 * This exception is used to signal
7 * a control flow change that needs
8 * the cooperation inside {@link StackRecorder}.
9 *
10 * <p>
11 * This class is only for javaflow internal code.
12 *
13 * @author Kohsuke Kawaguchi
14 */
15 public final class ContinuationDeath extends Error {
16 final String mode;
17
18 public ContinuationDeath(String mode) {
19 this.mode = mode;
20 }
21
22 /**
23 * Signals that the continuation wants to exit the execution.
24 */
25 static final String MODE_EXIT = "exit";
26 /**
27 * Signals that the execution should restart immediately
28 * from where it resumed.
29 */
30 static final String MODE_AGAIN = "again";
31 /**
32 * Signals that the exeuction should suspend,
33 * by using the original continuation.
34 */
35 static final String MODE_CANCEL = "cancel";
36 }