Search in sources :

Example 1 with InstanceAlertValueService

use of com.sohu.cache.stats.instance.InstanceAlertValueService in project cachecloud by sohutv.

the class InstanceAlertValueJob method action.

@Override
public void action(JobExecutionContext context) {
    try {
        long startTime = System.currentTimeMillis();
        SchedulerContext schedulerContext = context.getScheduler().getContext();
        ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY);
        InstanceAlertValueService instanceAlertValueService = applicationContext.getBean("instanceAlertValueService", InstanceAlertValueService.class);
        int instanceSize = instanceAlertValueService.monitorLastMinuteAllInstanceInfo();
        logger.warn("InstanceAlertValueJob monitor {} instance, costtime {} ms", instanceSize, (System.currentTimeMillis() - startTime));
    } catch (SchedulerException e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) SchedulerException(org.quartz.SchedulerException) InstanceAlertValueService(com.sohu.cache.stats.instance.InstanceAlertValueService) SchedulerContext(org.quartz.SchedulerContext)

Aggregations

InstanceAlertValueService (com.sohu.cache.stats.instance.InstanceAlertValueService)1 SchedulerContext (org.quartz.SchedulerContext)1 SchedulerException (org.quartz.SchedulerException)1 ApplicationContext (org.springframework.context.ApplicationContext)1