Example usage for org.apache.commons.javaflow Continuation startWith

List of usage examples for org.apache.commons.javaflow Continuation startWith

Introduction

In this page you can find the example usage for org.apache.commons.javaflow Continuation startWith.

Prototype

public static Continuation startWith(final Runnable pTarget) 

Source Link

Document

Starts executing the specified Runnable object in an environment that allows Continuation#suspend() .

Usage

From source file:com.topekalabs.bigmachine.lib.app.ContinuationSerializationTest.java

@Ignore
@Test/*from ww  w.ja  va2s  . com*/
public void networkSerializationTest() throws Exception {
    Socket outputSocket = null;
    ServerSocket inputSocket = null;

    outputSocket = new Socket("localhost", TEST_SOCKET);
    inputSocket = new ServerSocket(TEST_SOCKET);

    Continuation c = Continuation.startWith(new SimpleContinuationRunnable());

    Kryo kryo = new Kryo();
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Output output = new Output(bos);
    kryo.writeObject(output, c);
}

From source file:org.shelloid.netverif.TestRunnable2.java

public void run() {
    TestRunnable test = new TestRunnable();
    Continuation c = Continuation.startWith(test);
    System.out.println("returned a continuation");
    c = Continuation.continueWith(c);//from  www. j a  v  a  2  s  . c  o m
    System.out.println("returned a continuation: " + c);

}