當前位置: 首頁>>代碼示例>>Java>>正文


Java SchedulerException.getMessage方法代碼示例

本文整理匯總了Java中org.quartz.SchedulerException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java SchedulerException.getMessage方法的具體用法?Java SchedulerException.getMessage怎麽用?Java SchedulerException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.quartz.SchedulerException的用法示例。


在下文中一共展示了SchedulerException.getMessage方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: triggerJob

import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public ReturnT<String> triggerJob(int id) {
       XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
       if (xxlJobInfo == null) {
       	return new ReturnT<String>(ReturnT.FAIL_CODE, "任務ID非法");
	}

       String group = String.valueOf(xxlJobInfo.getJobGroup());
       String name = String.valueOf(xxlJobInfo.getId());

	try {
		XxlJobDynamicScheduler.triggerJob(name, group);
		return ReturnT.SUCCESS;
	} catch (SchedulerException e) {
		logger.error(e.getMessage(), e);
		return new ReturnT<String>(ReturnT.FAIL_CODE, e.getMessage());
	}
}
 
開發者ID:mmwhd,項目名稱:stage-job,代碼行數:19,代碼來源:XxlJobServiceImpl.java

示例2: start

import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
 * 
 * 啟動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());
	}
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:20,代碼來源:SfbestSchedulerContainer.java

示例3: stop

import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
 * 
 * 停止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());
		}
	}
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:20,代碼來源:SfbestSchedulerContainer.java

示例4: delete

import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public void delete(Node node) {
    try {
        quartzScheduler.unscheduleJob(new TriggerKey(node.getPath()));
    } catch (SchedulerException e) {
        throw new IllegalStatusException(e.getMessage());
    }
}
 
開發者ID:FlowCI,項目名稱:flow-platform,代碼行數:9,代碼來源:NodeCrontabServiceImpl.java

示例5: triggers

import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public List<Trigger> triggers() {
    try {
        List<? extends Trigger> triggersOfJob = quartzScheduler.getTriggersOfJob(nodeCrontabDetail.getKey());
        return Lists.newArrayList(triggersOfJob);
    } catch (SchedulerException e) {
        throw new IllegalStatusException(e.getMessage());
    }
}
 
開發者ID:FlowCI,項目名稱:flow-platform,代碼行數:10,代碼來源:NodeCrontabServiceImpl.java

示例6: cleanTriggers

import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public void cleanTriggers() {
    try {
        quartzScheduler.getTriggersOfJob(nodeCrontabDetail.getKey()).clear();
    } catch (SchedulerException e) {
        throw new IllegalStatusException(e.getMessage());
    }
}
 
開發者ID:FlowCI,項目名稱:flow-platform,代碼行數:9,代碼來源:NodeCrontabServiceImpl.java

示例7: attackHttpFlooding

import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
 * Executes command {@code ATTACK_HTTPFLOOD}.
 * @param attack the HTTP Flooding attack details.
 * @throws BotExecutionException when te attack cannot be scheduled.
 */
private static void attackHttpFlooding(HttpFloodAttack attack) throws BotExecutionException {
  LOGGER.traceEntry("attack={}", attack);
  LOGGER.info("Scheduling HTTP {} Flooding attack against {}...",
      attack.getMethod(), attack.getTarget());
  try {
    POOL.scheduleAttackHttpFlooding(attack);
  } catch (SchedulerException exc) {
    throw new BotExecutionException("Cannot schedule attack. %s", exc.getMessage());
  }
  LOGGER.info("Attack scheduled");
}
 
開發者ID:braineering,項目名稱:ares,代碼行數:17,代碼來源:CoreController.java

示例8: calmdown

import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
 * Executes command {@code CALMDOWN}.
 * @throws BotExecutionException when the bot cannot calm down.
 */
private static void calmdown() throws BotExecutionException {
  LOGGER.info("Calming down bot...");
  try {
    POOL.calmdown();
  } catch (SchedulerException exc) {
    throw new BotExecutionException("Cannot calmdown. %s", exc.getMessage());
  }
  LOGGER.info("Bot calmed down");
}
 
開發者ID:braineering,項目名稱:ares,代碼行數:14,代碼來源:CoreController.java

示例9: wakeup

import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
 * Executes command {@code WAKEUP}.
 * @throws BotExecutionException when bot cannot be waken up.
 */
private static void wakeup() throws BotExecutionException {
  LOGGER.trace("Waking up...");
  try {
    POOL.resume();
  } catch (SchedulerException exc) {
    throw new BotExecutionException("Cannot resume jobs. %s", exc.getMessage());
  }
  LOGGER.info("Awake");
  changeState(BotState.EXECUTION);
}
 
開發者ID:braineering,項目名稱:ares,代碼行數:15,代碼來源:CoreController.java

示例10: allocateResources

import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
 * Allocates bot's resources.
 * @throws BotInitializationException when the scheduler cannot be initialized.
 */
private static void allocateResources() throws BotInitializationException {
  LOGGER.trace("Allocating resources...");

  LOGGER.trace("Initializing HTTP client...");
  HTTP_CLIENT = HttpClients.createDefault();
  LOGGER.trace("Initializing HTTP client initialized...");

  LOGGER.trace("Initializing scheduler...");
  try {
    POOL = new BotPool();
  } catch (SchedulerException exc) {
    throw new BotInitializationException("Bot scheduler cannot be initialized. %s", exc.getMessage());
  }
  LOGGER.trace("Scheduler initialized");

  LOGGER.trace("Initializing analyzers");
  if (AppConfigurationService.getConfigurations().isSysInfo()) {
    Analyzer systemAnalyzer = new SystemAnalyzer("system-analysis");
    ANALYZERS.add(systemAnalyzer);
  }

  if (AppConfigurationService.getConfigurations().isNetInfo()) {
    Analyzer networkAnalyzer = new NetworkAnalyzer("network-analysis");
    ANALYZERS.add(networkAnalyzer);
  }
  LOGGER.trace("Analyzers initialized");

  LOGGER.trace("Resources allocated");
}
 
開發者ID:braineering,項目名稱:ares,代碼行數:34,代碼來源:CoreController.java

示例11: add

import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public ReturnT<String> add(XxlJobInfo jobInfo) {
	// valid
	XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
	if (group == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請選擇“執行器”");
	}
	if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入格式正確的“Cron”");
	}
	if (StringUtils.isBlank(jobInfo.getJobDesc())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入“任務描述”");
	}
	if (StringUtils.isBlank(jobInfo.getAuthor())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入“負責人”");
	}
	if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "路由策略非法");
	}
	if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "阻塞處理策略非法");
	}
	if (ExecutorFailStrategyEnum.match(jobInfo.getExecutorFailStrategy(), null) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "失敗處理策略非法");
	}
	if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "運行模式非法非法");
	}
	if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && StringUtils.isBlank(jobInfo.getExecutorHandler())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入“JobHandler”");
	}

	// fix "\r" in shell
	if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
		jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
	}

	// childJobKey valid
	if (StringUtils.isNotBlank(jobInfo.getChildJobKey())) {
		String[] childJobKeys = jobInfo.getChildJobKey().split(",");
		for (String childJobKeyItem: childJobKeys) {
			String[] childJobKeyArr = childJobKeyItem.split("_");
			if (childJobKeyArr.length!=2) {
				return new ReturnT<String>(ReturnT.FAIL_CODE, MessageFormat.format("子任務Key({0})格式錯誤", childJobKeyItem));
			}
			XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.valueOf(childJobKeyArr[1]));
			if (childJobInfo==null) {
				return new ReturnT<String>(ReturnT.FAIL_CODE, MessageFormat.format("子任務Key({0})無效", childJobKeyItem));
			}
		}
	}

	// add in db
	xxlJobInfoDao.save(jobInfo);
	if (jobInfo.getId() < 1) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "新增任務失敗");
	}

	// add in quartz
       String qz_group = String.valueOf(jobInfo.getJobGroup());
       String qz_name = String.valueOf(jobInfo.getId());
       try {
           XxlJobDynamicScheduler.addJob(qz_name, qz_group, jobInfo.getJobCron());
           //XxlJobDynamicScheduler.pauseJob(qz_name, qz_group);
           return ReturnT.SUCCESS;
       } catch (SchedulerException e) {
           logger.error(e.getMessage(), e);
           try {
               xxlJobInfoDao.delete(jobInfo.getId());
               XxlJobDynamicScheduler.removeJob(qz_name, qz_group);
           } catch (SchedulerException e1) {
               logger.error(e.getMessage(), e1);
           }
           return new ReturnT<String>(ReturnT.FAIL_CODE, "新增任務失敗:" + e.getMessage());
       }
}
 
開發者ID:mmwhd,項目名稱:stage-job,代碼行數:77,代碼來源:XxlJobServiceImpl.java

示例12: add

import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public ReturnT<String> add(XxlJobInfo jobInfo) {
	// valid
	XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
	if (group == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請選擇“執行器”");
	}
	if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入格式正確的“Cron”");
	}
	if (StringUtils.isBlank(jobInfo.getJobDesc())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入“任務描述”");
	}
	if (StringUtils.isBlank(jobInfo.getAuthor())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入“負責人”");
	}
	if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "路由策略非法");
	}
	if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "阻塞處理策略非法");
	}
	if (ExecutorFailStrategyEnum.match(jobInfo.getExecutorFailStrategy(), null) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "失敗處理策略非法");
	}
	if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "運行模式非法非法");
	}
	if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && StringUtils.isBlank(jobInfo.getExecutorHandler())) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "請輸入“JobHandler”");
	}

	// fix "\r" in shell
	if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
		jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
	}

	// childJobKey valid
	if (StringUtils.isNotBlank(jobInfo.getChildJobKey())) {
		String[] childJobKeys = jobInfo.getChildJobKey().split(",");
		for (String childJobKeyItem: childJobKeys) {
			String[] childJobKeyArr = childJobKeyItem.split("_");
			if (childJobKeyArr.length!=2) {
				return new ReturnT<String>(ReturnT.FAIL_CODE, MessageFormat.format("子任務Key({0})格式錯誤", childJobKeyItem));
			}
			XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.valueOf(childJobKeyArr[1]));
			if (childJobInfo==null) {
				return new ReturnT<String>(ReturnT.FAIL_CODE, MessageFormat.format("子任務Key({0})無效", childJobKeyItem));
			}
		}
	}

	// add in db
	xxlJobInfoDao.save(jobInfo);
	if (jobInfo.getId() < 1) {
		return new ReturnT<String>(ReturnT.FAIL_CODE, "新增任務失敗");
	}

	// add in quartz
       String qz_group = String.valueOf(jobInfo.getJobGroup());
       String qz_name = String.valueOf(jobInfo.getId());
       try {
           XxlJobDynamicScheduler.addJob(qz_name, qz_group, jobInfo.getJobCron());
           //XxlJobDynamicScheduler.pauseJob(qz_name, qz_group);
           return ReturnT.SUCCESS;
       } catch (SchedulerException e) {
           logger.error("", e);
           try {
               xxlJobInfoDao.delete(jobInfo.getId());
               XxlJobDynamicScheduler.removeJob(qz_name, qz_group);
           } catch (SchedulerException e1) {
               logger.error("", e1);
           }
           return new ReturnT<String>(ReturnT.FAIL_CODE, "新增任務失敗:" + e.getMessage());
       }
}
 
開發者ID:kevinKaiF,項目名稱:xxl-job,代碼行數:77,代碼來源:XxlJobServiceImpl.java


注:本文中的org.quartz.SchedulerException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。