Package co.paralleluniverse.fibers

Examples of co.paralleluniverse.fibers.Fiber.join()


        Thread.sleep(200);

        channel1.send("hello");

        fib.join();
    }

    @Test
    public void testSelectSend1() throws Exception {
        final Channel<String> channel1 = newChannel();
View Full Code Here


        Thread.sleep(200);
        String m2 = channel1.receive();
        assertThat(m2, equalTo("hi1"));

        fib.join();
    }

    @Test
    public void testSelectSend2() throws Exception {
        final Channel<String> channel1 = newChannel();
View Full Code Here

        assertThat(m1, equalTo("hi2"));

        String m2 = channel1.receive();
        assertThat(m2, equalTo("hi1"));

        fib.join();
    }

    @Test
    public void testSelectSendWithClose1() throws Exception {
        final Channel<String> channel1 = newChannel();
View Full Code Here

        Thread.sleep(200);

        channel2.close();

        fib.join();
    }

    @Test
    public void testSelectSendWithClose2() throws Exception {
        final Channel<String> channel1 = newChannel();
View Full Code Here

        }).start();


        channel2.close();

        fib.join();
    }

    @Test
    public void testSelectSendTimeout() throws Exception {
        final Channel<String> channel1 = newChannel();
View Full Code Here

        String m1 = channel3.receive();

        assertThat(m1, equalTo("bye3")); // the first send is cancelled

        fib.join();
    }

    @Test
    public void testSelectSendWithTimeoutChannel() throws Exception {
        final Channel<String> channel1 = newChannel();
View Full Code Here

        String m1 = channel3.receive();

        assertThat(m1, equalTo("bye3")); // the first send is cancelled

        fib.join();
    }
}
View Full Code Here

        System.out.println("f1: " + f1);
        f2.join();
        System.out.println("f2: " + f2);
        f3.join();
        System.out.println("f3: " + f3);
        f4.join();
        System.out.println("f4: " + f4);
        t1.join();
        System.out.println("t1: " + t1);
        t2.join();
        System.out.println("t2: " + t2);
View Full Code Here

                ch.close();
            }
        }).start();

        fib1.join();
        fib2.join();
    }

    @Test
    public void testFilterThreadToFiber() throws Exception {
        final Channel<Integer> ch = newChannel();
View Full Code Here

        ch.send(3);
        ch.send(4);
        ch.send(5);
        ch.close();

        fib.join();
    }

    @Test
    public void testFilterFiberToThread() throws Exception {
        final Channel<Integer> ch = newChannel();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.