use of com.sohu.cache.machine.MachineCenter in project cachecloud by sohutv.
the class MachineMonitorJob method action.
@Override
public void action(JobExecutionContext context) {
try {
JobDataMap dataMap = context.getMergedJobDataMap();
String ip = dataMap.getString(ConstUtils.HOST_KEY);
long hostId = dataMap.getLong(ConstUtils.HOST_ID_KEY);
SchedulerContext schedulerContext = context.getScheduler().getContext();
ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY);
MachineCenter machineCenter = applicationContext.getBean("machineCenter", MachineCenter.class);
machineCenter.asyncMonitorMachineStats(hostId, ip);
} catch (SchedulerException e) {
logger.error(e.getMessage(), e);
}
}
use of com.sohu.cache.machine.MachineCenter in project cachecloud by sohutv.
the class MachineJob method action.
@Override
public void action(JobExecutionContext context) {
try {
JobDataMap dataMap = context.getMergedJobDataMap();
Date now = new Date();
dataMap.put(ConstUtils.TRIGGER_TIME_KEY, now);
SchedulerContext schedulerContext = context.getScheduler().getContext();
ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY);
MachineCenter machineCenter = applicationContext.getBean("machineCenter", MachineCenter.class);
String ip = dataMap.getString(ConstUtils.HOST_KEY);
long hostId = dataMap.getLong(ConstUtils.HOST_ID_KEY);
machineCenter.asyncCollectMachineInfo(hostId, ScheduleUtil.getCollectTime(new Date()), ip);
} catch (SchedulerException e) {
logger.error(e.getMessage(), e);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
Aggregations