Skip to content

vooron/java_async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Java async

Promise

Code, passed into Promise constructor will be executed in another thread. As soon, as result will be calculated, then chain will be triggered.

    new Promise<String>(() -> {
            Thread.sleep(1000);
            return "Promise result";
    }).then((data) -> {
            out.println(data);
            Thread.sleep(1000);
            return "New promise string";
    }).then((data) -> {
        out.println(data);
    });

Output will be:

Promise result
New promise string

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages