Package co.paralleluniverse.fibers

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


        ch1.send(2);
        ch1.send(3);
        ch1.send(4);
        ch1.send(5);
        ch1.close();
        fib.join();
    }

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


                ch.send("a message");
            }
        }).start();

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

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

        }).start();

        Thread.sleep(50);
        ch.send("a message");

        fib.join();
    }

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

        String m = ch.receive();

        assertThat(m, equalTo("a message"));

        fib.join();
    }

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

                assertTrue(thrown);
            }
        }).start();

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

    @Ignore
    @Test
    public void whenReceiveNotCalledFromOwnerThenThrowException2() throws Exception {
View Full Code Here

        } catch (Throwable e) {
            thrown = true;
        }
        assertTrue(thrown);

        fib.join();
    }

    @Ignore
    @Test
    public void whenReceiveNotCalledFromOwnerThenThrowException3() throws Exception {
View Full Code Here

        String m = ch.receive();

        assertThat(m, equalTo("a message"));

        fib.join();
    }

    @Ignore
    @Test
    public void whenReceiveNotCalledFromOwnerThenThrowException4() throws Exception {
View Full Code Here

        ch.close();

        ch.send(6);
        ch.send(7);

        fib.join();
    }

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

        ch.close(new Exception("foo"));

        ch.send(6);
        ch.send(7);

        fib.join();
    }

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

        ch.close();

        ch.send(6);
        ch.send(7);

        fib.join();
    }

    @Test
    public void testChannelCloseExceptionWithSleep() 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.