Package com.alibaba.otter.shared.arbitrate.model

Examples of com.alibaba.otter.shared.arbitrate.model.MainStemEventData


        // do nothing
    }

    private void startDetecting() {
        // 直接发送已追上的状态,保持和eromanga兼容处理
        MainStemEventData mainStemData = new MainStemEventData();
        mainStemData.setPipelineId(pipelineId);
        mainStemData.setStatus(MainStemEventData.Status.OVERTAKE);
        arbitrateEventService.mainStemEvent().single(mainStemData);

        // 启动异步线程定时监控,一定会有数据过来
        String schedulerName = String.format("pipelineId = %s , CanalDetecting", String.valueOf(pipelineId));
        scheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory(schedulerName));
View Full Code Here


        }

    }

    private void notifyMainstemStatus(MainStemEventData.Status status) {
        MainStemEventData mainStemData = new MainStemEventData();
        mainStemData.setPipelineId(pipelineId);
        mainStemData.setStatus(status);
        arbitrateEventService.mainStemEvent().single(mainStemData);
    }
View Full Code Here

            }
            processTime.put(processStat.getProcessId(), timeout);
        }

        // 获取下mainstem状态信息
        MainStemEventData mainstemData = arbitrateViewService.mainstemData(pipeline.getChannelId(), pipelineId);

        PositionEventData positionData = arbitrateViewService.getCanalCursor(pipeline.getParameters().getDestinationName(),
                                                                             pipeline.getParameters().getMainstemClientId());

        context.put("pipeline", pipeline);
View Full Code Here

    private void initMainStem(Long pipelineId) {
        String pipelinePath = StagePathUtils.getPipeline(channelId, pipelineId);
        String path = pipelinePath + "/" + ArbitrateConstants.NODE_MAINSTEM;

        MainStemEventData eventData = new MainStemEventData();
        eventData.setStatus(MainStemEventData.Status.TAKEING);
        byte[] bytes = JsonUtils.marshalToByte(eventData);// 初始化的数据对象

        zookeeper.create(path, bytes, CreateMode.EPHEMERAL);
    }
View Full Code Here

    }

    private void updateMainStem(Long pipelineId, MainStemEventData.Status status) {
        String pipelinePath = StagePathUtils.getPipeline(channelId, pipelineId);
        String path = pipelinePath + "/" + ArbitrateConstants.NODE_MAINSTEM;
        MainStemEventData eventData = new MainStemEventData();
        eventData.setStatus(status);
        byte[] bytes = JsonUtils.marshalToByte(eventData);// 初始化的数据对象

        zookeeper.writeData(path, bytes);
    }
View Full Code Here

        channelEvent.init(channelId);
        pipelineEvent.init(channelId, pipelineId);
        channelEvent.start(channelId);

        String path = pipelinePath + "/" + ArbitrateConstants.NODE_MAINSTEM;
        MainStemEventData eventData = new MainStemEventData();
        eventData.setStatus(MainStemEventData.Status.OVERTAKE);
        eventData.setNid(nid);
        byte[] bytes = JsonUtils.marshalToByte(eventData);// 初始化的数据对象

        zookeeper.create(path, bytes, CreateMode.EPHEMERAL);
    }
View Full Code Here

        channelEvent.start(channelId);// 启动
        mainStemEvent = new MainStemArbitrateEvent();
        try {
            mainStemEvent.await(pipelineId);

            MainStemEventData eventData = new MainStemEventData();
            eventData.setPipelineId(pipelineId);
            eventData.setStatus(MainStemEventData.Status.OVERTAKE);
            mainStemEvent.single(eventData);

            PermitMonitor permit = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
            permit.waitForPermit();// 阻塞等待授权
        } catch (InterruptedException e) {
View Full Code Here

        @Override
        public void run() {
            try {
                arbitrateEventService.mainStemEvent().await(pipelineId);
                Thread.sleep(1000L);
                MainStemEventData eventData = new MainStemEventData();
                eventData.setPipelineId(pipelineId);
                eventData.setStatus(MainStemEventData.Status.OVERTAKE);
                arbitrateEventService.mainStemEvent().single(eventData);
                while (true) {
                    // 处理eromanga的数据,这里通过sleep进行模拟
                    Thread.sleep(10 * 1000);
                }
View Full Code Here

        String path = ManagePathUtils.getMainStem(channelId, pipelineId);
        try {
            while (true) {
                Stat stat = new Stat();
                byte[] bytes = zookeeper.readData(path, stat);
                MainStemEventData mainStemData = JsonUtils.unmarshalFromByte(bytes, MainStemEventData.class);
                mainStemData.setActive(false);
                try {
                    zookeeper.writeData(path, JsonUtils.marshalToByte(mainStemData), stat.getVersion());
                    break;
                } catch (ZkBadVersionException e) {
                    // ignore , retrying
View Full Code Here

            logger.error(path, e);
        }
    }

    private void initMainStemStatus(byte[] bytes) {
        MainStemEventData eventData = JsonUtils.unmarshalFromByte(bytes, MainStemEventData.class);
        MainStemEventData.Status newStatus = eventData.getStatus();

        if (logger.isDebugEnabled()) {
            logger.debug("pipeline[{}] new mainStemStatus is [{}]", getPipelineId(), newStatus);
        }
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.arbitrate.model.MainStemEventData

Copyright © 2018 www.massapicom. 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.