use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateExecutorInDockerCount.
private void saveOrUpdateExecutorInDockerCount(int exeInDocker, String zkAddr) {
try {
String exeInDockerString = JSON.toJSONString(exeInDocker);
SaturnStatistics exeInDockerFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.EXECUTOR_IN_DOCKER_COUNT, zkAddr);
if (exeInDockerFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.EXECUTOR_IN_DOCKER_COUNT, zkAddr, exeInDockerString);
saturnStatisticsService.create(ss);
} else {
exeInDockerFromDB.setResult(exeInDockerString);
saturnStatisticsService.updateByPrimaryKey(exeInDockerFromDB);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method setUnnormalJobMonitorStatusToRead.
@Override
public void setUnnormalJobMonitorStatusToRead(String currentZkAddr, String uuid) {
if (StringUtils.isBlank(uuid)) {
return;
}
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.UNNORMAL_JOB, currentZkAddr);
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<AbnormalJob> jobs = JSON.parseArray(result, AbnormalJob.class);
if (jobs != null) {
boolean find = false;
for (AbnormalJob job : jobs) {
if (uuid.equals(job.getUuid())) {
job.setRead(true);
find = true;
break;
}
}
if (find) {
saturnStatistics.setResult(JSON.toJSONString(jobs));
saturnStatisticsService.updateByPrimaryKeySelective(saturnStatistics);
}
}
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateAbnormalContainer.
private void saveOrUpdateAbnormalContainer(List<AbnormalContainer> abnormalContainerList, String zkAddr) {
try {
String abnormalContainerJsonString = JSON.toJSONString(abnormalContainerList);
SaturnStatistics abnormalContainerFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.ABNORMAL_CONTAINER, zkAddr);
if (abnormalContainerFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.ABNORMAL_CONTAINER, zkAddr, abnormalContainerJsonString);
saturnStatisticsService.create(ss);
} else {
abnormalContainerFromDB.setResult(abnormalContainerJsonString);
saturnStatisticsService.updateByPrimaryKey(abnormalContainerFromDB);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateJobCount.
private void saveOrUpdateJobCount(int jobCount, String zkAddr) {
try {
String jobCountString = JSON.toJSONString(jobCount);
SaturnStatistics jobCountFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.JOB_COUNT, zkAddr);
if (jobCountFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.JOB_COUNT, zkAddr, jobCountString);
saturnStatisticsService.create(ss);
} else {
jobCountFromDB.setResult(jobCountString);
saturnStatisticsService.updateByPrimaryKey(jobCountFromDB);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method setTimeout4AlarmJobMonitorStatusToRead.
@Override
public void setTimeout4AlarmJobMonitorStatusToRead(String currentZkAddr, String uuid) {
if (StringUtils.isBlank(uuid)) {
return;
}
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TIMEOUT_4_ALARM_JOB, currentZkAddr);
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<Timeout4AlarmJob> jobs = JSON.parseArray(result, Timeout4AlarmJob.class);
if (jobs != null) {
boolean find = false;
for (Timeout4AlarmJob job : jobs) {
if (uuid.equals(job.getUuid())) {
job.setRead(true);
find = true;
break;
}
}
if (find) {
saturnStatistics.setResult(JSON.toJSONString(jobs));
saturnStatisticsService.updateByPrimaryKeySelective(saturnStatistics);
}
}
}
}
Aggregations