use of co.paralleluniverse.fibers.SuspendExecution in project quasar by puniverse.
the class InheritTest method testInherit.
@Test
public void testInherit() {
final C dut = new C();
Fiber c = new Fiber((String) null, null, new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution {
dut.myMethod();
}
});
for (int i = 0; i < 3; i++) {
exec(c);
}
assertEquals(5, dut.result.size());
assertEquals("a", dut.result.get(0));
assertEquals("o1", dut.result.get(1));
assertEquals("o2", dut.result.get(2));
assertEquals("b", dut.result.get(3));
assertEquals("b", dut.result.get(4));
}
use of co.paralleluniverse.fibers.SuspendExecution in project quasar by puniverse.
the class InstrumentationOptimizerTest method testDontSkipForwardsWithReflectiveCalls.
@Test
public void testDontSkipForwardsWithReflectiveCalls() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
try {
dontSkipForwardsWithReflectiveCalls();
} catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
throw new RuntimeException(ex);
}
}
}).start().join();
assertFalse(isOptimized("skipForwardsWithReflectiveCalls"));
}
use of co.paralleluniverse.fibers.SuspendExecution in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableObject.
@Test
public void testSkipForwardsToSuspendableObject() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableObject();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableObject"));
}
use of co.paralleluniverse.fibers.SuspendExecution in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableFloat.
@Test
public void testSkipForwardsToSuspendableFloat() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableFloat();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableFloat"));
}
use of co.paralleluniverse.fibers.SuspendExecution in project quasar by puniverse.
the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableVoid.
@Test
public void testSkipForwardsToSuspendableVoid() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
skipForwardsToSuspendableVoid();
}
}).start().join();
assertTrue(isOptimized("skipForwardsToSuspendableVoid"));
}
Aggregations