package hprose.example.promise;

import hprose.util.concurrent.Promise;

public class Exam7 {
    public static void normal() {
        System.out.println("before Promise constructor");
        Promise<String> promise = new Promise<>(() -> {
            System.out.println("running Promise constructor");
            return "promise from Promise constructor";
        });
        promise.then((String value) -> {
            System.out.println(value);
        });
        System.out.println("after Promise constructor");
    }
    public static void delayed() {
        System.out.println("before Promise.delayed");
        Promise<String> promise = (Promise<String>)Promise.delayed(300, () -> {
            System.out.println("running Promise.delayed");
            return "promise from Promise.delayed";
        });
        promise.then((String value) -> {
            System.out.println(value);
        });
        System.out.println("after Promise.delayed");
    }
    public static void main(String[] args) throws InterruptedException {
        delayed();
        normal();
        Thread.sleep(400);
    }
}

@@ -140,33 +140,64 @@
 tem.out.println(
-%22
+System.currentTimeMillis() + %22: 
 before Promise c
@@ -289,33 +289,64 @@
 tem.out.println(
-%22
+System.currentTimeMillis() + %22: 
 running Promise 
@@ -491,32 +491,68 @@
 tem.out.println(
+System.currentTimeMillis() + %22: %22 + 
 value);%0A        
@@ -574,33 +574,64 @@
 tem.out.println(
-%22
+System.currentTimeMillis() + %22: 
 after Promise co
@@ -711,17 +711,48 @@
 println(
-%22
+System.currentTimeMillis() + %22: 
 before P
@@ -880,17 +880,48 @@
 println(
-%22
+System.currentTimeMillis() + %22: 
 running 
@@ -1074,16 +1074,52 @@
 println(
+System.currentTimeMillis() + %22: %22 + 
 value);%0A
@@ -1157,17 +1157,48 @@
 println(
-%22
+System.currentTimeMillis() + %22: 
 after Pr

Update Exam7