本文整理汇总了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());
}
}
示例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());
}
}
示例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());
}
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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");
}
示例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");
}
示例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);
}
示例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");
}
示例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());
}
}
示例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());
}
}