Package com.alibaba.otter.node.etl.load.loader.weight

Examples of com.alibaba.otter.node.etl.load.loader.weight.WeightBarrier.await()


    @Test
    public void test_simple() {
        final WeightBarrier barrier = new WeightBarrier(10);
        try {
            barrier.await(10);// 可以成功通过
        } catch (InterruptedException e1) {
            want.fail();
        }

        try {
View Full Code Here


                    count.countDown();
                    return null;
                }
            });

            barrier.await(11);// 会被阻塞
            count.await();
            executor.shutdown();
        } catch (InterruptedException e) {
            want.fail();
        }
View Full Code Here

            for (int i = 0; i < 10; i++) {
                final long index = i;
                executor.submit(new Callable() {

                    public Object call() throws Exception {
                        barrier.await(index);
                        want.number(index).isLe(barrier.state());
                        count.countDown();
                        return null;
                    }
                });
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.