@Service
public class TimerJobService implements LzhTimerJobDao{
Logger logger = LoggerFactory.getLogger(TimerJobService.class);
private String keyId = ProgramSetEnum.TimerJobSet.getValue();
@Autowired
private ProjectSetMapper projectSetMapper;
@PostConstruct
private void timerJobThreadStart(){
InetAddress ia=null;
try {
ia = InetAddress.getLocalHost();
String localname = ia.getHostName();
String localip = ia.getHostAddress();
logger.warn("本机名称是:" + localname);
logger.warn("本机的ip是 :" + localip);
String ip = getProjectSet(ProgramSetEnum.TimerJobIP);
if (ip != null && ip.equals(localip)) {
logger.warn("定时任务配置加载中");
LzhTimerJobUtil.threadStart(this, 30, null);
}
} catch (Exception e) {
logger.error("【定时任务配置,获取ip信息出错!!!】", e);
}
}
}