Package nginx.clojure

Examples of nginx.clojure.Coroutine


    return rt;
  }

  @Test
  public void testAddTowResults() {
    Coroutine co = new Coroutine(new Runnable() {
     
      @Override
      public void run() throws SuspendExecution {
        ints.add(add1132());
      }
    });
    co.resume();
    assertTrue(ints.isEmpty());
    co.resume();
    assertEquals(1, ints.size());
    assertEquals(11, (int)ints.get(0));
    co.resume();
    assertEquals(3, ints.size());
    assertEquals(11, (int)ints.get(0));
    assertEquals(32, (int)ints.get(1));
    assertEquals(11+32, (int)ints.get(2));
    assertTrue(co.getStack().allObjsAreNull());
  }
View Full Code Here


   
  }
 
  @Test
  public void testNCatchCallS() {
    Coroutine co = new Coroutine(new Runnable() {
      @Override
      public void run() throws SuspendExecution {
        nmCatch2();
      }
    });
    co.resume();
    for (int i = 0; i < 6; i++) {
      co.resume();
      assertEquals(i, (int)ints.get(i));
    }
    assertEquals(Coroutine.State.FINISHED, co.getState());
    assertTrue(co.getStack().allObjsAreNull());
  }
View Full Code Here

    }
    return null;
  }
 
  protected void attachCoroutine() {
    Coroutine ac = Coroutine.getActiveCoroutine();
    if (coroutine == null || coroutine.getState() == Coroutine.State.FINISHED) {
      coroutine = ac;
    }
  }
View Full Code Here

TOP

Related Classes of nginx.clojure.Coroutine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.