Examples of SelectStageListener


Examples of com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor.SelectStageListener

    public void testProcess_init() {
        final List<Long> initProcessIds = new ArrayList<Long>();
        try {
            initProcess();
            // initProcessIds.add(p1);
            SelectStageListener select = new SelectStageListener(pipelineId);
            sleep();

            Long p2 = select.waitForProcess();
            Long p3 = select.waitForProcess();
            Long p4 = select.waitForProcess();
            initProcessIds.add(p2);
            initProcessIds.add(p3);
            initProcessIds.add(p4);

            StageMonitor monitor = ArbitrateFactory.getInstance(pipelineId, StageMonitor.class);
            List<Long> processIds = monitor.getCurrentProcessIds();

            want.collection(processIds).isEqualTo(initProcessIds);
            select.destory();
            ArbitrateFactory.destory(pipelineId);
        } catch (InterruptedException e) {
            want.fail();
        } finally {
            for (Long processId : initProcessIds) {
View Full Code Here

Examples of com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor.SelectStageListener

    @Test
    public void testProcess_dymanic() {
        final List<Long> initProcessIds = new ArrayList<Long>();
        try {
            initProcess();
            SelectStageListener select = new SelectStageListener(pipelineId);
            final Long p2 = select.waitForProcess();
            final Long p3 = select.waitForProcess();

            final CountDownLatch count = new CountDownLatch(1);
            ExecutorService executor = Executors.newCachedThreadPool();
            executor.submit(new Runnable() {

                public void run() {
                    sleep();
                    destoryProcess(p2);
                    sleep();
                    destoryProcess(p3);
                    count.countDown();
                }
            });

            Long p4 = select.waitForProcess();
            Long p5 = select.waitForProcess();
            initProcessIds.add(p4);
            initProcessIds.add(p5);

            sleep();
            StageMonitor monitor = ArbitrateFactory.getInstance(pipelineId, StageMonitor.class);
            List<Long> processIds = monitor.getCurrentProcessIds();
            want.collection(processIds).isEqualTo(initProcessIds);
            count.await();
            select.destory();
            ArbitrateFactory.destory(pipelineId);
        } catch (InterruptedException e) {
            want.fail();
        } finally {
            for (Long processId : initProcessIds) {
View Full Code Here

Examples of com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor.SelectStageListener

            EtlEventData tdata2 = transformEvent.await(pipelineId);

            transformEvent.single(tdata1);
            transformEvent.single(tdata2);

            SelectStageListener selectStageListener = ArbitrateFactory.getInstance(pipelineId,
                                                                                   SelectStageListener.class);
            selectStageListener.destory();
            // load stage
            EtlEventData ldata1 = loadEvent.await(pipelineId);
            loadEvent.single(ldata1);
            Long p1 = ldata1.getProcessId();
View Full Code Here

Examples of com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor.SelectStageListener

        Assert.notNull(pipelineId);

        PermitMonitor permitMonitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        permitMonitor.waitForPermit();// 阻塞等待授权

        SelectStageListener selectStageListener = ArbitrateFactory.getInstance(pipelineId, SelectStageListener.class);
        Long processId = selectStageListener.waitForProcess(); // 符合条件的processId

        ChannelStatus status = permitMonitor.getChannelPermit();
        if (status.isStart()) {// 即时查询一下当前的状态,状态随时可能会变

            try {
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.