Examples of TerminEventData


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

    @Test
    public void test_Rollback() {
        normalProcess();
        // 发送rollback信号
        TerminEventData rollback = new TerminEventData();
        rollback.setPipelineId(pipelineId);
        rollback.setType(TerminType.ROLLBACK);
        terminEvent.single(rollback);

        PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        want.bool(monitor.getChannelPermit(true).isPause()).is(true);
View Full Code Here

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

    @Test
    public void test_Shutdown() {
        normalProcess();
        // 发送shutdown信号
        TerminEventData shutdown = new TerminEventData();
        shutdown.setPipelineId(pipelineId);
        shutdown.setType(TerminType.SHUTDOWN);
        terminEvent.single(shutdown);

        PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        want.bool(monitor.getChannelPermit(true).isStop()).is(true);
View Full Code Here

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

                }

                print = new PrintWriter(log);
                while (true) {
                    try {
                        final TerminEventData eventData = arbitrateEventService.terminEvent().await(pipelineId);
                        // 可以使用异步处理
                        TerminType terminType = eventData.getType();
                        if (terminType.isNormal()) {
                            // 更新游标,判断是否发送ack给eromanga信息
                        } else {
                            // 出现异常了,rollback对应的数据
                        }

                        arbitrateEventService.terminEvent().ack(eventData);// 处理完了,通知下仲裁器
                        StringBuilder builder = new StringBuilder();
                        builder.append("=============================== time : " + printDate(new Date().getTime())).append("\n");

                        builder.append("pipeline : ").append(pipelineId).append("\n");
                        builder.append("\t termin : ").append(eventData.getProcessId()).append(" type : ").append(eventData.getType().name()).append("\n");
                        print.println(builder);
                        print.flush();
                    } catch (InterruptedException e) {
                        break;
                    }
View Full Code Here

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

    @Test
    public void test_Restart() {
        normalProcess();
        // 发送restart信号
        TerminEventData rollback = new TerminEventData();
        rollback.setPipelineId(pipelineId);
        rollback.setType(TerminType.RESTART);
        terminEvent.single(rollback);

        sleep(4000L);
        PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        want.bool(monitor.getChannelPermit(true).isStart()).is(true);
        sleep(4000L);

        // 发送shutdown信号
        TerminEventData shutdown = new TerminEventData();
        shutdown.setPipelineId(pipelineId);
        shutdown.setType(TerminType.SHUTDOWN);
        terminEvent.single(shutdown);

        want.bool(monitor.getChannelPermit(true).isStop()).is(true);

        // 删除对应的错误节点
View Full Code Here

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

    private void destoryTermin() {
        String path = StagePathUtils.getTerminRoot(pipelineId);
        List<String> terminNodes = zookeeper.getChildren(path);
        for (String node : terminNodes) {
            // 删除对应的错误节点
            TerminEventData termin = new TerminEventData();
            termin.setPipelineId(pipelineId);
            termin.setProcessId(StagePathUtils.getProcessId(node));
            System.out.println("remove termin node: " + path + "/" + node);
            terminEvent.ack(termin);// 发送ack信号,删除termin节点
        }
    }
View Full Code Here

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

            // load stage
            EtlEventData ldata1 = loadEvent.await(pipelineId);
            loadEvent.single(ldata1);
            Long p1 = ldata1.getProcessId();

            TerminEventData terminData1 = new TerminEventData();
            terminData1.setPipelineId(pipelineId);
            terminData1.setProcessId(p1);
            terminEvent.ack(terminData1);// 发送ack信号,删除termin节点

        } catch (InterruptedException e) {
            want.fail();
        }
View Full Code Here

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

    @Test
    public void test_Rollback() {
        normalProcess();
        // 发送rollback信号
        TerminEventData rollback = new TerminEventData();
        rollback.setPipelineId(pipelineId);
        rollback.setType(TerminType.ROLLBACK);
        terminEvent.single(rollback);

        PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        want.bool(monitor.getChannelPermit().isPause()).is(true);
View Full Code Here

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

    @Test
    public void test_Shutdown() {
        normalProcess();
        // 发送shutdown信号
        TerminEventData shutdown = new TerminEventData();
        shutdown.setPipelineId(pipelineId);
        shutdown.setType(TerminType.SHUTDOWN);
        terminEvent.single(shutdown);

        PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        want.bool(monitor.getChannelPermit().isStop()).is(true);
View Full Code Here

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

    @Test
    public void test_Restart() {
        normalProcess();
        // 发送restart信号
        TerminEventData rollback = new TerminEventData();
        rollback.setPipelineId(pipelineId);
        rollback.setType(TerminType.RESTART);
        terminEvent.single(rollback);

        PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
        sleep(4000L);
        want.bool(monitor.getChannelPermit().isStart()).is(true);

        // 发送shutdown信号
        TerminEventData shutdown = new TerminEventData();
        shutdown.setPipelineId(pipelineId);
        shutdown.setType(TerminType.SHUTDOWN);
        terminEvent.single(shutdown);

        want.bool(monitor.getChannelPermit().isStop()).is(true);

        // 删除对应的错误节点
View Full Code Here

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

    private void destoryTermin() {
        String path = StagePathUtils.getTerminRoot(pipelineId);
        List<String> terminNodes = zookeeper.getChildren(path);
        for (String node : terminNodes) {
            // 删除对应的错误节点
            TerminEventData termin = new TerminEventData();
            termin.setPipelineId(pipelineId);
            termin.setProcessId(StagePathUtils.getProcessId(node));
            System.out.println("remove termin node: " + path + "/" + node);
            terminEvent.ack(termin);// 发送ack信号,删除termin节点
        }
    }
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.