Search in sources :

Example 86 with Fiber

use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.

the class InstrumentationOptimizerTest method testSkipForwardsWithLoopAfter.

@Test
public void testSkipForwardsWithLoopAfter() throws InterruptedException, SuspendExecution, ExecutionException {
    new Fiber(new SuspendableRunnable() {

        @Override
        public void run() throws SuspendExecution, InterruptedException {
            skipForwardsWithLoopAfter();
        }
    }).start().join();
    assertTrue(isOptimized("skipForwardsWithLoopAfter"));
}
Also used : SuspendExecution(co.paralleluniverse.fibers.SuspendExecution) SuspendableRunnable(co.paralleluniverse.strands.SuspendableRunnable) Fiber(co.paralleluniverse.fibers.Fiber) Test(org.junit.Test)

Example 87 with Fiber

use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.

the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableLong.

@Test
public void testSkipForwardsToSuspendableLong() throws InterruptedException, SuspendExecution, ExecutionException {
    new Fiber(new SuspendableRunnable() {

        @Override
        public void run() throws SuspendExecution, InterruptedException {
            skipForwardsToSuspendableLong();
        }
    }).start().join();
    assertTrue(isOptimized("skipForwardsToSuspendableLong"));
}
Also used : SuspendExecution(co.paralleluniverse.fibers.SuspendExecution) SuspendableRunnable(co.paralleluniverse.strands.SuspendableRunnable) Fiber(co.paralleluniverse.fibers.Fiber) Test(org.junit.Test)

Example 88 with Fiber

use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.

the class InstrumentationOptimizerTest method testDontSkipForwardsWithLoop.

@Test
public void testDontSkipForwardsWithLoop() throws InterruptedException, SuspendExecution, ExecutionException {
    new Fiber(new SuspendableRunnable() {

        @Override
        public void run() throws SuspendExecution, InterruptedException {
            dontSkipForwardsWithLoop();
        }
    }).start().join();
    assertFalse(isOptimized("skipForwardsWithLoop"));
}
Also used : SuspendExecution(co.paralleluniverse.fibers.SuspendExecution) SuspendableRunnable(co.paralleluniverse.strands.SuspendableRunnable) Fiber(co.paralleluniverse.fibers.Fiber) Test(org.junit.Test)

Example 89 with Fiber

use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.

the class InstrumentationOptimizerTest method testSkipForwardsWithMethodAfter.

@Test
public void testSkipForwardsWithMethodAfter() throws InterruptedException, SuspendExecution, ExecutionException {
    new Fiber(new SuspendableRunnable() {

        @Override
        public void run() throws SuspendExecution, InterruptedException {
            skipForwardsWithMethodAfter();
        }
    }).start().join();
    assertTrue(isOptimized("skipForwardsWithMethodAfter"));
}
Also used : SuspendExecution(co.paralleluniverse.fibers.SuspendExecution) SuspendableRunnable(co.paralleluniverse.strands.SuspendableRunnable) Fiber(co.paralleluniverse.fibers.Fiber) Test(org.junit.Test)

Example 90 with Fiber

use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.

the class InstrumentationOptimizerTest method testSkipForwardsToSuspendableInt.

@Test
public void testSkipForwardsToSuspendableInt() throws InterruptedException, SuspendExecution, ExecutionException {
    new Fiber(new SuspendableRunnable() {

        @Override
        public void run() throws SuspendExecution, InterruptedException {
            skipForwardsToSuspendableInt();
        }
    }).start().join();
    assertTrue(isOptimized("skipForwardsToSuspendableInt"));
}
Also used : SuspendExecution(co.paralleluniverse.fibers.SuspendExecution) SuspendableRunnable(co.paralleluniverse.strands.SuspendableRunnable) Fiber(co.paralleluniverse.fibers.Fiber) Test(org.junit.Test)

Aggregations

Fiber (co.paralleluniverse.fibers.Fiber)105 Test (org.junit.Test)88 SuspendableRunnable (co.paralleluniverse.strands.SuspendableRunnable)73 SuspendExecution (co.paralleluniverse.fibers.SuspendExecution)20 Strand (co.paralleluniverse.strands.Strand)8 IntChannel (co.paralleluniverse.strands.channels.IntChannel)4 QueueCapacityExceededException (co.paralleluniverse.strands.queues.QueueCapacityExceededException)4 ExecutionException (java.util.concurrent.ExecutionException)3 Ignore (org.junit.Ignore)3 Timeout (co.paralleluniverse.strands.Timeout)2 Channel (co.paralleluniverse.strands.channels.Channel)2 ReceivePort (co.paralleluniverse.strands.channels.ReceivePort)2 TimeoutException (java.util.concurrent.TimeoutException)2 ActorRef (co.paralleluniverse.actors.ActorRef)1 AbstractServerHandler (co.paralleluniverse.actors.behaviors.AbstractServerHandler)1 ServerActor (co.paralleluniverse.actors.behaviors.ServerActor)1 Function2 (co.paralleluniverse.common.util.Function2)1 Pair (co.paralleluniverse.common.util.Pair)1 FiberScheduler (co.paralleluniverse.fibers.FiberScheduler)1 FiberWriter (co.paralleluniverse.fibers.FiberWriter)1