Example usage for org.apache.commons.javaflow.extras Continuations start

List of usage examples for org.apache.commons.javaflow.extras Continuations start

Introduction

In this page you can find the example usage for org.apache.commons.javaflow.extras Continuations start.

Prototype

public static Continuation start(ContinuableRunnable o) 

Source Link

Usage

From source file:org.apache.commons.javaflow.examples.lambdas.LambdasExampleMinimal.java

public static void main(final String[] argv) throws Exception {

    Continuation cc = Continuations.start(() -> {
        for (int i = 1; i <= 5; i++) {
            System.out.println("Exe before suspend");
            Continuation.suspend(i);//from  ww w.j  av a 2s.  co m
            System.out.println("Exe after suspend");
        }
    });

    for (; null != cc; cc = cc.resume()) {
        System.out.println("Interrupted " + cc.value());
    }

    System.out.println("===");
}