+ */
+public final class AsyncProgram {
+ private AsyncProgram() {
+ }
+
+ public static void main(String[] args) throws InterruptedException {
+ withoutAsync();
+ System.out.println();
+ withAsync();
+ }
+
+ private static void withoutAsync() {
+ System.out.println("Start sync");
+ for (int i = 0; i < 20; ++i) {
+ for (int j = 0; j <= i; ++j) {
+ System.out.print(j);
+ System.out.print(' ');
+ }
+ System.out.println();
+ }
+ System.out.println("Complete sync");
+ }
+
+ private static void withAsync() throws InterruptedException {
+ System.out.println("Start async");
+ for (int i = 0; i < 20; ++i) {
+ for (int j = 0; j <= i; ++j) {
+ System.out.print(j);
+ System.out.print(' ');
+ }
+ System.out.println();
+ if (i % 3 == 0) {
+ System.out.println("Suspend for a second");
+ Thread.sleep(1000);
+ }
+ }
+ System.out.println("Complete async");
+ }
+}
diff --git a/teavm-samples/teavm-samples-async/src/main/webapp/WEB-INF/web.xml b/teavm-samples/teavm-samples-async/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 000000000..6471cd77a
--- /dev/null
+++ b/teavm-samples/teavm-samples-async/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,21 @@
+
+
+
+
\ No newline at end of file
diff --git a/teavm-samples/teavm-samples-async/src/main/webapp/index.html b/teavm-samples/teavm-samples-async/src/main/webapp/index.html
new file mode 100644
index 000000000..96817c4a0
--- /dev/null
+++ b/teavm-samples/teavm-samples-async/src/main/webapp/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+ Continuation-passing style demo
+
+
+
+
+
+ Please, open developer's console to view program's output
+
+
\ No newline at end of file