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

Examples of com.alibaba.otter.shared.communication.model.arbitrate.NodeAlarmEvent


    private LogRecordDAO        logRecordDao;

    public void create(Event event) {
        LogRecord logRecord = new LogRecord();
        if (event instanceof NodeAlarmEvent) {
            NodeAlarmEvent nodeAlarmEvent = (NodeAlarmEvent) event;
            Pipeline tempPipeline = new Pipeline();
            tempPipeline.setId(nodeAlarmEvent.getPipelineId());
            logRecord.setPipeline(tempPipeline);
            logRecord.setNid(nodeAlarmEvent.getNid());
            logRecord.setTitle(nodeAlarmEvent.getTitle());
            logRecord.setMessage(nodeAlarmEvent.getMessage());
        }
        create(logRecord);
    }
View Full Code Here


                rules.add(rule);
                returns(rules);
            }
        };

        NodeAlarmEvent event = new NodeAlarmEvent();
        event.setMessage("pid:77 nid:5 exception:EXCEPTON,nid:5[setl:ERROR ## SelectTask processId = 644408,parallelism = 5,ProcessEnd processId = 644394 invalid]");
        event.setNid(5L);
        event.setPipelineId(2L);
        event.setTitle("EXCEPTON");
        monitor.feed(event, 2L);
    }
View Full Code Here

            // 解决process rpc模式下释放不完整,通过stop完整释放一次所有对象资源
            channelService.stopChannel(channelId);
            channelService.startChannel(channelId);
        }

        NodeAlarmEvent alarm = new NodeAlarmEvent();
        alarm.setPipelineId(-1L);
        alarm.setTitle(MonitorName.EXCEPTION.name());
        if (result) {
            if (!needStop) {
                alarm.setMessage(String.format("cid:%s restart recovery successful for rid:%s",
                                               String.valueOf(channelId), String.valueOf(ruleId)));
            } else {
                alarm.setMessage(String.format("cid:%s stop recovery successful for rid:%s", String.valueOf(channelId),
                                               String.valueOf(ruleId)));
            }

            try {
                exceptionRuleMonitor.feed(alarm, alarm.getPipelineId());
            } catch (Exception e) {
                logger.error(String.format("ERROR # exceptionRuleMonitor error for %s", alarm.toString()), e);
            }
        }

        return result;
    }
View Full Code Here

        for (Channel channel : channels) {
            channelIds.add(channel.getId());
        }
        Collections.sort(channelIds);

        NodeAlarmEvent alarm = new NodeAlarmEvent();
        alarm.setPipelineId(-1L);
        alarm.setTitle(MonitorName.EXCEPTION.name());
        alarm.setMessage(String.format("nid:%s is dead and restart cids:%s", String.valueOf(deadNode),
                                       channelIds.toString()));
        try {
            exceptionRuleMonitor.feed(alarm, alarm.getPipelineId());
        } catch (Exception e) {
            logger.error(String.format("ERROR # exceptionRuleMonitor error for %s", alarm.toString()), e);
        }

        for (Long channelId : channelIds) {// 重启一下对应的channel
            boolean result = arbitrateManageService.channelEvent().restart(channelId);
            if (result) {
View Full Code Here

            // 解决process rpc模式下释放不完整,通过stop完整释放一次所有对象资源
            channelService.stopChannel(channelId);
            channelService.startChannel(channelId);
        }

        NodeAlarmEvent alarm = new NodeAlarmEvent();
        alarm.setPipelineId(-1L);
        alarm.setTitle(MonitorName.EXCEPTION.name());
        if (result) {
            if (!needStop) {
                alarm.setMessage(String.format("cid:%s restart recovery successful for rid:%s",
                                               String.valueOf(channelId), String.valueOf(ruleId)));
            } else {
                alarm.setMessage(String.format("cid:%s stop recovery successful for rid:%s", String.valueOf(channelId),
                                               String.valueOf(ruleId)));
            }

            try {
                exceptionRuleMonitor.feed(alarm, alarm.getPipelineId());
            } catch (Exception e) {
                logger.error(String.format("ERROR # exceptionRuleMonitor error for %s", alarm.toString()), e);
            }
        }

        return result;
    }
View Full Code Here

    @Override
    public void feed(Object data, Long pipelineId) {
        if (!(data instanceof NodeAlarmEvent)) {
            return;
        }
        NodeAlarmEvent alarmEvent = (NodeAlarmEvent) data;
        // 异常一定需要记录日志
        String message = String.format(MESAGE_FORMAT, alarmEvent.getPipelineId(), alarmEvent.getNid(),
                                       alarmEvent.getMessage());
        logRecordAlarm(pipelineId, alarmEvent.getNid(), MonitorName.EXCEPTION, message);
        // 报警检查
        List<AlarmRule> rules = alarmRuleService.getAlarmRules(pipelineId, AlarmRuleStatus.ENABLE);

        // TODO 需要给 alarmRuleService 提需求
        Date now = new Date();
View Full Code Here

    private static final Logger           logger         = LoggerFactory.getLogger(AlarmClientService.class);
    private static final String           MESSAGE_FORMAT = "{0}:{1}";
    private ArbitrateCommmunicationClient arbitrateCommmunicationClient;

    public void sendAlarm(Long currentNid, Long pipelineId, String title, String msg) {
        final NodeAlarmEvent event = new NodeAlarmEvent();
        event.setNid(currentNid);
        event.setTitle(MonitorName.EXCEPTION.name());
        event.setMessage(MessageFormat.format(MESSAGE_FORMAT, title, msg));
        event.setPipelineId(pipelineId);
        arbitrateCommmunicationClient.callManager(event, new Callback<Object>() {

            public void call(Object result) {
                logger.info("##callManager successed! event:[{}]", event.toString());
            }

        });
    }
View Full Code Here

        for (Channel channel : channels) {
            channelIds.add(channel.getId());
        }
        Collections.sort(channelIds);

        NodeAlarmEvent alarm = new NodeAlarmEvent();
        alarm.setPipelineId(-1L);
        alarm.setTitle(MonitorName.EXCEPTION.name());
        alarm.setMessage(String.format("nid:%s is dead and restart cids:%s", String.valueOf(deadNode),
                                       channelIds.toString()));
        try {
            exceptionRuleMonitor.feed(alarm, alarm.getPipelineId());
        } catch (Exception e) {
            logger.error(String.format("ERROR # exceptionRuleMonitor error for %s", alarm.toString()), e);
        }

        for (Long channelId : channelIds) {// 重启一下对应的channel
            boolean result = arbitrateManageService.channelEvent().restart(channelId);
            if (result) {
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.communication.model.arbitrate.NodeAlarmEvent

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.