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); } } } }
public void execute( @Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, Context context) throws Exception { @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>(); if ("请输入关键字(目前支持Node的ID、名字搜索)".equals(searchKey)) { searchKey = ""; } condition.put("searchKey", searchKey); int count = canalService.getCount(condition); Paginator paginator = new Paginator(); paginator.setItems(count); paginator.setPage(pageIndex); condition.put("offset", paginator.getOffset()); condition.put("length", paginator.getLength()); List<Canal> canals = canalService.listByCondition(condition); List<SeniorCanal> seniorCanals = new ArrayList<SeniorCanal>(); for (Canal canal : canals) { SeniorCanal seniorCanal = new SeniorCanal(); seniorCanal.setId(canal.getId()); seniorCanal.setName(canal.getName()); seniorCanal.setStatus(canal.getStatus()); seniorCanal.setDesc(canal.getDesc()); seniorCanal.setCanalParameter(canal.getCanalParameter()); seniorCanal.setGmtCreate(canal.getGmtCreate()); seniorCanal.setGmtModified(canal.getGmtModified()); List<Pipeline> pipelines = pipelineService.listByDestinationWithoutOther(canal.getName()); seniorCanal.setPipelines(pipelines); seniorCanal.setUsed(!pipelines.isEmpty()); seniorCanals.add(seniorCanal); } context.put("seniorCanals", seniorCanals); context.put("paginator", paginator); context.put("searchKey", searchKey); }
public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception { Pipeline pipeline = pipelineService.findById(pipelineId); context.put("pipeline", pipeline); context.put("nodes", nodeService.listAll()); }