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

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

Introduction

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

Prototype

public static Continuation continueWith(final Continuation pOldContinuation) 

Source Link

Document

Resumes the execution of the specified continuation from where it's left off.

Usage

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

public void start() {
    Iterator<Agent> it = agents.iterator();
    while (it.hasNext()) {
        Agent agent = it.next();/*from  ww w  .j  a v a  2 s . co m*/
        Continuation c = Continuation.startSuspendedWith(agent.getRoutine());
        Event e = new Event(agent, c, new EventMeta(EventMeta.REASON.AGENT_START, null, null));
        events.addLast(e);
    }
    while (!events.isEmpty()) {
        Event e = events.removeFirst();
        this.setCurrentHost(e.getAgent().getHost());
        Continuation c = Continuation.continueWith(e.getContinuation());
        if (c != null) {
            EventMeta m = (EventMeta) c.value();
            processEvent(new Event(e.getAgent(), c, m));
        }
    }
}

From source file:org.shelloid.netverif.test.suite.VerificationTestCase.java

public void testBlackRed2() {
    System.out.println("testBlackRed2");
    assertTrue(fromSuite());//  w  w w.  j  ava  2 s.  c o  m
    final Runnable r = new BlackRed();
    final Continuation c1 = Continuation.startSuspendedWith(r);
    assertTrue(c1 != null);
    final Continuation c2 = Continuation.continueWith(c1);
    assertTrue(c2 != null);
    final Continuation c3 = Continuation.continueWith(c2);
    assertTrue(c3 == null);
}

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);
    System.out.println("returned a continuation: " + c);

}