use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.
the class PipelineServiceImpl method listByNodeId.
public List<Pipeline> listByNodeId(Long nodeId) {
Assert.assertNotNull(nodeId);
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineNodeRelationDO> relations = pipelineNodeRelationDao.listByNodeId(nodeId);
if (relations.isEmpty()) {
logger.debug("DEBUG ## query the relation by nodeId:" + nodeId + " return null,maybe hasn't create any relations.");
return pipelines;
}
List<Long> piplineIds = new ArrayList<Long>();
for (PipelineNodeRelationDO relation : relations) {
piplineIds.add(relation.getPipelineId());
}
List<PipelineDO> pipelineDos = pipelineDao.listByMultiId(piplineIds.toArray(new Long[piplineIds.size()]));
if (pipelineDos.isEmpty()) {
String exceptionCause = "query the pipelines by pipelineIds:" + piplineIds.toString() + " return null!";
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
pipelines = doToModel(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query the pipelines by nodeId:" + nodeId + " has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.
the class PipelineServiceImpl method listByIds.
@Override
public List<Pipeline> listByIds(Long... identities) {
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineDO> pipelineDos = new ArrayList<PipelineDO>();
if (identities.length < 1) {
pipelineDos = pipelineDao.listAll();
if (pipelineDos.isEmpty()) {
logger.debug("DEBUG ## couldn't query any pipeline, maybe hasn't create any pipeline.");
return pipelines;
}
} else {
pipelineDos = pipelineDao.listByMultiId(identities);
if (pipelineDos.isEmpty()) {
String exceptionCause = "couldn't query any pipeline by pipelineIds:" + Arrays.toString(identities);
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
}
pipelines = doToModel(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query pipelines has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.
the class PipelineServiceImpl method listByChannelIdsWithoutOther.
public List<Pipeline> listByChannelIdsWithoutOther(Long... channelIds) {
Assert.assertNotNull(channelIds);
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineDO> pipelineDos = pipelineDao.listByChannelIds(channelIds);
if (pipelineDos.isEmpty()) {
logger.debug("DEBUG ## query pipeline by channelId:" + channelIds + " return null.");
return pipelines;
}
pipelines = doToModelWithoutOther(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query pipelines by channelIds:" + channelIds.toString() + " has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.
the class PipelineServiceImpl method listByDestinationWithoutOther.
public List<Pipeline> listByDestinationWithoutOther(String destination) {
Assert.assertNotNull(destination);
List<Pipeline> pipelines = new ArrayList<Pipeline>();
try {
List<PipelineDO> pipelineDos = pipelineDao.listByDestinationCondition(destination);
if (pipelineDos.isEmpty()) {
logger.debug("DEBUG ## query pipeline by destination:" + destination + " return null.");
return pipelines;
}
pipelines = doToModelWithoutOther(pipelineDos);
} catch (Exception e) {
logger.error("ERROR ## query pipelines by destination:" + destination + " has an exception!");
throw new ManagerException(e);
}
return pipelines;
}
use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.
the class RestartAlarmRecovery method recovery.
public void recovery(AlarmRule alarmRule, long alarmCount) {
if (alarmCount >= alarmRule.getRecoveryThresold()) {
synchronized (queue) {
// 做异步处理,避免并发时重复执行recovery
Pipeline pipeline = pipelineService.findById(alarmRule.getPipelineId());
// 超过2倍阀值,强制停止一下通道释放一下内存
// recovery的下一次启用修复
boolean needStop = (alarmCount >= alarmRule.getRecoveryThresold() + 1);
AlarmRecoveryDelayed delayed = new AlarmRecoveryDelayed(pipeline.getChannelId(), alarmRule.getId(), needStop, checkTime);
if (!queue.contains(delayed)) {
queue.add(delayed);
}
}
}
}
Aggregations