1 package org.apache.commons.javaflow.bytecode.transformation.rewrite;
2
3 import org.apache.commons.javaflow.Continuation;
4
5 import java.io.Serializable;
6
7
8
9
10
11
12
13
14 public final class BlackRed implements Runnable, Serializable {
15
16 public void run() {
17
18 new Black( new Suspend()).run();
19 }
20
21
22 class Black implements Runnable {
23 final Runnable r;
24
25 public Black( Runnable r) {
26 this.r = r;
27 }
28
29 public void run() {
30 String s = "foo";
31 r.run();
32 }
33 }
34
35
36 class Red implements Runnable {
37 final Runnable r;
38
39 public Red( Runnable r) {
40 this.r = r;
41 }
42
43 public void run() {
44 int i = 5;
45 r.run();
46 }
47 }
48
49
50 class Suspend implements Runnable {
51 public void run() {
52 Continuation.suspend();
53 }
54 }
55
56 }
57