private List<QuartzScheduleJobBO> getAllHostSchedule() { List<QuartzScheduleJobBO> jobs = new ArrayList<QuartzScheduleJobBO>(); List<HostConfigDomain> hostList = hostConfigDAO.listNormalHostConfig(); for (HostConfigDomain domain : hostList) { List<DeamonScheduleconfigDomain> list = deamonScheduleconfigDAO.listServerDeamonScheduleconfig(domain.getHostId()); if (list != null && list.size() > 0) { for (DeamonScheduleconfigDomain scheduleDomain : list) { QuartzScheduleJobBO bo = convertConfigToScheduleJob(scheduleDomain); if (bo == null) continue; bo.setJobStatus(String.valueOf(scheduleDomain.getStatus())); bo.setServerId(domain.getServerId()); bo.setIpAddr(domain.getIpAddr()); jobs.add(bo); } } } return jobs; }
private List<QuartzScheduleJobBO> getAllDbSchedule(Integer dbType) { List<QuartzScheduleJobBO> jobs = new ArrayList<QuartzScheduleJobBO>(); List<DbConfigDomain> dbList = dbConfigDAO.listNormalDbConfig(dbType); for (DbConfigDomain domain : dbList) { List<DeamonScheduleconfigDomain> list = deamonScheduleconfigDAO.listDbTypeDeamonScheduleconfig(domain.getDbId(), dbType); if (list != null && list.size() > 0) { for (DeamonScheduleconfigDomain scheduleDomain : list) { QuartzScheduleJobBO bo = convertConfigToScheduleJob(scheduleDomain); if (bo == null) continue; bo.setJobStatus(String.valueOf(scheduleDomain.getStatus())); bo.setServerId(domain.getServerId()); bo.setPort(domain.getPort()); bo.setIpAddr(domain.getIpAddr()); jobs.add(bo); } } } return jobs; }
@SuppressWarnings("unchecked") private QuartzScheduleJobBO convertConfigToScheduleJob( DeamonScheduleconfigDomain scheduleDomain) { QuartzScheduleJobBO bo = new QuartzScheduleJobBO(); bo.setJobId(scheduleDomain.getId()); bo.setBeanId(scheduleDomain.getBeanId()); bo.setCronExpression(scheduleDomain.getQuartzConf()); bo.setDomainId(scheduleDomain.getMonitorId()); bo.setJobGroup(scheduleDomain.getJobGroup()); bo.setJobName(scheduleDomain.getJobName()); bo.setTaskType(scheduleDomain.getConfigType().toString()); String className = scheduleDomain.getScheduleClass(); try { Class<? extends Job> cl = ((Class<? extends Job>) Class.forName(className)); bo.setJobClass(cl); } catch (ClassNotFoundException e) { // e.printStackTrace(); // 记录日志 LOGGER.error("类没找到", e); return null; } return bo; }