Examples of ExtractStageListener


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

    public EtlEventData await(Long pipelineId) throws InterruptedException {
        Assert.notNull(pipelineId);
        PermitMonitor permitMonitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        permitMonitor.waitForPermit();// 阻塞等待授权

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

        ChannelStatus status = permitMonitor.getChannelPermit();
        if (status.isStart()) {// 即时查询一下当前的状态,状态随时可能会变
            // 根据pipelineId+processId构造对应的path
            String path = StagePathUtils.getSelectStage(pipelineId, processId);
View Full Code Here

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

            List<String> p4Stages = Arrays.asList(ArbitrateConstants.NODE_SELECTED);
            stages.put(p4, p4Stages);

            // 进行验证
            ExtractStageListener extract = new ExtractStageListener(pipelineId);
            Long processId = extract.waitForProcess();
            want.number(processId).isEqualTo(p2);

            // 验证下process信息
            StageMonitor monitor = ArbitrateFactory.getInstance(pipelineId, StageMonitor.class);
            List<Long> processIds = monitor.getCurrentProcessIds();
            // 获取下stage信息
            List<String> currentP1Stages = monitor.getCurrentStages(p1);
            List<String> currentP2Stages = monitor.getCurrentStages(p2);
            List<String> currentP3Stages = monitor.getCurrentStages(p3);
            List<String> currentP4Stages = monitor.getCurrentStages(p4);

            want.collection(processIds).isEqualTo(initProcessIds);
            want.collection(currentP1Stages).isEqualTo(stages.get(p1));
            want.collection(currentP2Stages).isEqualTo(stages.get(p2));
            want.collection(currentP3Stages).isEqualTo(stages.get(p3));
            want.collection(currentP4Stages).isEqualTo(stages.get(p4));
            extract.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.ExtractStageListener

            Long p3 = initProcess();
            initStage(p3, ArbitrateConstants.NODE_SELECTED, getData(nid + 1));

            // 初始化信息
            ExtractStageListener extract = new ExtractStageListener(pipelineId);

            // 开始变化
            destoryStage(p1, ArbitrateConstants.NODE_SELECTED);
            destoryStage(p1, ArbitrateConstants.NODE_EXTRACTED);
            destoryStage(p1, ArbitrateConstants.NODE_TRANSFORMED);
            destoryProcess(p1);
            Long p4 = initProcess();
            initStage(p4, ArbitrateConstants.NODE_SELECTED, getData(nid));

            Long p5 = initProcess();
            initStage(p5, ArbitrateConstants.NODE_SELECTED, getData(nid + 1));

            Long p6 = initProcess();

            // 准备清理数据
            initProcessIds.add(p2);
            initProcessIds.add(p3);
            initProcessIds.add(p4);
            initProcessIds.add(p5);
            initProcessIds.add(p6);

            List<String> p1Stages = Lists.newArrayList();
            stages.put(p1, p1Stages);

            List<String> p2Stages = Arrays.asList(ArbitrateConstants.NODE_SELECTED, ArbitrateConstants.NODE_EXTRACTED);
            stages.put(p2, p2Stages);

            List<String> p3Stages = Arrays.asList(ArbitrateConstants.NODE_SELECTED);
            stages.put(p3, p3Stages);

            List<String> p4Stages = Arrays.asList(ArbitrateConstants.NODE_SELECTED);
            stages.put(p4, p4Stages);

            List<String> p5Stages = Arrays.asList(ArbitrateConstants.NODE_SELECTED);
            stages.put(p5, p5Stages);

            List<String> p6Stages = Lists.newArrayList();
            stages.put(p6, p6Stages);

            sleep();// sleep一下,等待数据同步
            // 进行验证
            Long processId = extract.waitForProcess();
            want.number(processId).isEqualTo(p4);

            // 验证下process信息
            StageMonitor monitor = ArbitrateFactory.getInstance(pipelineId, StageMonitor.class);
            List<Long> processIds = monitor.getCurrentProcessIds();
            // 获取下stage信息
            List<String> currentP1Stages = monitor.getCurrentStages(p1);
            List<String> currentP2Stages = monitor.getCurrentStages(p2);
            List<String> currentP3Stages = monitor.getCurrentStages(p3);
            List<String> currentP4Stages = monitor.getCurrentStages(p4);
            List<String> currentP5Stages = monitor.getCurrentStages(p5);
            List<String> currentP6Stages = monitor.getCurrentStages(p6);

            want.collection(processIds).isEqualTo(initProcessIds);
            want.collection(currentP1Stages).isEqualTo(stages.get(p1));
            want.collection(currentP2Stages).isEqualTo(stages.get(p2));
            want.collection(currentP3Stages).isEqualTo(stages.get(p3));
            want.collection(currentP4Stages).isEqualTo(stages.get(p4));
            want.collection(currentP5Stages).isEqualTo(stages.get(p5));
            want.collection(currentP6Stages).isEqualTo(stages.get(p6));
            extract.destory();
            ArbitrateFactory.destory(pipelineId);
        } catch (InterruptedException e) {
            want.fail();
        } finally {
            for (Long processId : initProcessIds) {
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.