Java Code Examples for org.quartz.SchedulerException#getCause()

The following examples show how to use org.quartz.SchedulerException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HarvestAgentHeartBeatJob.java    From webcurator with Apache License 2.0 6 votes vote down vote up
@Override
protected void executeInternal(JobExecutionContext aJobContext) throws JobExecutionException {
    int triggerState = -2;
    try {
        triggerState = aJobContext.getScheduler().getTriggerState(null, "HeartBeatTriggerGroup");
        aJobContext.getScheduler().pauseTriggerGroup("HeartBeatTriggerGroup");

        HarvestAgentStatusDTO status = harvestAgent.getStatus();
        notifier.heartbeat(status);

        aJobContext.getScheduler().resumeTriggerGroup("HeartBeatTriggerGroup");
    }
    catch (SchedulerException e) {
        e.printStackTrace();
        if (e.getCause() != null)
            e.getCause().printStackTrace();
        throw new JobExecutionException("Heartbeat failed controlling the scheduler. (triggerState is: " + triggerState + ")");
    }
}
 
Example 2
Source File: SfbestSchedulerContainer.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * 启动QuartzScheduler
 *
 * @author zhangshaobin
 * @created 2013-1-4 下午4:11:50
 *
 */
public void start() throws BusinessException {
	try {
		SchedulerFactory sf = new StdSchedulerFactory("quartz.properties");
		scheduler = sf.getScheduler();
		scheduler.start();
		logger.info(new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]").format(new Date()) + " Quartz started!");
	} catch (SchedulerException e) {
		logger.error("启动Quartz出错:" + e.getMessage(), e.getCause());
		throw new BusinessException(e.getMessage(), e.getCause());
	}
}
 
Example 3
Source File: SfbestSchedulerContainer.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * 停止QuartzScheduler
 *
 * @author zhangshaobin
 * @created 2013-1-4 下午5:18:15
 *
 * @throws BusinessException
 */
public void stop() throws BusinessException {
	if (null != scheduler) {
		try {
			scheduler.shutdown();
		} catch (SchedulerException e) {
			logger.error("停止Quartz出错:" + e.getMessage(), e.getCause());
			throw new BusinessException(e.getMessage(), e.getCause());
		}
	}
}
 
Example 4
Source File: AgentService.java    From opencron with Apache License 2.0 5 votes vote down vote up
public void addOrUpdate(Agent agent) {
    /**
     * 修改过agent
     */
    boolean update = false;
    if (agent.getAgentId()!=null) {
        update = true;
    }

    /**
     * fix bug.....
     * 修改了agent要刷新所有在任务队列里对应的作业,
     * 否则一段端口改变了,任务队列里的还是更改前的连接端口,
     * 当作业执行的时候就会连接失败...
     *
     */
    if (update) {
        queryDao.save(agent);
        /**
         * 获取该执行器下所有的自动执行,并且是quartz类型的作业
         */
        List<JobVo> jobVos = jobService.getJobVoByAgentId(agent, Opencron.ExecType.AUTO, Opencron.CronType.QUARTZ);
        try {
            schedulerService.put(jobVos,this.executeService);
        } catch (SchedulerException e) {
            /**
             * 创新任务列表失败,抛出异常,整个事务回滚...
             */
            throw new RuntimeException(e.getCause());
        }
    }else {
        queryDao.save(agent);
    }

    /**
     * 同步缓存...
     */
    flushAgent();

}