public void recovery(AlarmRule alarmRule) { Pipeline pipeline = pipelineService.findById(alarmRule.getPipelineId()); AlarmRecoveryDelayed delayed = new AlarmRecoveryDelayed(pipeline.getChannelId(), alarmRule.getId(), false, checkTime); // 做异步处理,避免并发时重复执行recovery synchronized (queue) { if (!queue.contains(delayed)) { queue.add(delayed); } } }
public void recovery(AlarmRule alarmRule, long alarmCount) { if (alarmCount >= alarmRule.getRecoveryThresold()) { synchronized (queue) { // 做异步处理,避免并发时重复执行recovery Pipeline pipeline = pipelineService.findById(alarmRule.getPipelineId()); // 超过2倍阀值,强制停止一下通道释放一下内存 boolean needStop = (alarmCount >= alarmRule.getRecoveryThresold() + 1); // recovery的下一次启用修复 AlarmRecoveryDelayed delayed = new AlarmRecoveryDelayed( pipeline.getChannelId(), alarmRule.getId(), needStop, checkTime); if (!queue.contains(delayed)) { queue.add(delayed); } } } }