本文整理匯總了Java中org.quartz.SchedulerException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java SchedulerException.printStackTrace方法的具體用法?Java SchedulerException.printStackTrace怎麽用?Java SchedulerException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.quartz.SchedulerException
的用法示例。
在下文中一共展示了SchedulerException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: view
import org.quartz.SchedulerException; //導入方法依賴的package包/類
@RequestMapping(value = ACTION_VIEW, method = RequestMethod.GET)
public String view(HttpServletRequest request, HttpServletResponse response) {
try {
Iterator<?> it = request.getParameterMap().entrySet().iterator();
QuartzSchedule entity = new QuartzSchedule();
while (it.hasNext()) {
Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
entity.setValue((String) ent.getKey(),
((String[]) ent.getValue())[0]);
}
List<?> list = service.iQuartzGroupService
.selectByWhere(new QuartzGroup());
request.setAttribute(LIST, list);
Map<?, ?> map = (Map<?, ?>) service.iQuartzScheduleService
.select(entity);
request.setAttribute(ENTITY, map);
} catch (SchedulerException e) {
e.printStackTrace();
}
return VIEW_WIDGET + VIEW_QUARTZ + PAGE_VIEW;
}
示例2: quartz
import org.quartz.SchedulerException; //導入方法依賴的package包/類
@RequestMapping(value = ACTION_LIST)
public String quartz(HttpServletRequest request,
HttpServletResponse response) {
try {
Iterator<?> it = request.getParameterMap().entrySet().iterator();
QuartzSchedule entity = new QuartzSchedule();
while (it.hasNext()) {
Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
entity.setValue((String) ent.getKey(),
((String[]) ent.getValue())[0]);
}
request.setAttribute("group", entity.getGroup());
request.setAttribute("title", entity.getName());
Map<?, ?> map = (Map<?, ?>) service.iQuartzScheduleService
.selectByWhere(entity);
List<?> list = service.iQuartzGroupService
.selectByWhere(new QuartzGroup());
request.setAttribute(LIST, list);
request.setAttribute(ENTITY, map);
} catch (SchedulerException e) {
e.printStackTrace();
}
return VIEW_WIDGET + VIEW_QUARTZ + PAGE_LIST;
}
示例3: run
import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public void run(String... strings) throws Exception {
try {
/*
* 在 Quartz 中, scheduler 由 SchedulerFactory創建:DirectSchedulerFactory 或者
* StdSchedulerFactory。第二種工廠 StdSchedulerFactory 使用較多,因為
* DirectSchedulerFactory 使用起來不夠方便,需要作許多詳細的手工編碼設置。
*/
// 獲取Scheduler實例
scheduler = StdSchedulerFactory.getDefaultScheduler();
scheduler.start();
// System.out.println("scheduler.start");
// System.out.println(scheduler.getSchedulerName());
// 注冊任務
JobDetail jobDetail = JobBuilder.newJob(QuartzTask.class).withIdentity("QuartzTaskJob", "QuartzTaskGroup").build();
// 設置出發時間(每1天執行1次)
SimpleScheduleBuilder simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(24).repeatForever();
Trigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger", "group").startNow().withSchedule(simpleScheduleBuilder).build();
// 交由Scheduler安排觸發
scheduler.scheduleJob(jobDetail, trigger);
} catch (SchedulerException e) {
e.printStackTrace();
}
}
示例4: stopJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* Stop a job
*/
@Override
public boolean stopJob(String jobName) {
System.out.println("JobServiceImpl.stopJob()");
try{
String jobKey = jobName;
String groupKey = "SampleGroup";
Scheduler scheduler = schedulerFactoryBean.getScheduler();
JobKey jkey = new JobKey(jobKey, groupKey);
return scheduler.interrupt(jkey);
} catch (SchedulerException e) {
System.out.println("SchedulerException while stopping job. error message :"+e.getMessage());
e.printStackTrace();
}
return false;
}
示例5: execute
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* 執行單個定時任務
*
* @param strVal
* @return String
* @throws SchedulerException
*/
@Override
public String execute(String strVal) throws SchedulerException {
JobKey key = null;
try {
String[] jobKey = strVal.split("\\.");
if (jobKey.length > 0) {
key = JobKey.jobKey(jobKey[1], jobKey[0]);
Trigger trigger = newTrigger()
.withIdentity(jobKey[1] + UUID.randomUUID().toString(),
jobKey[0]).withPriority(100).forJob(key)
.build();
scheduler.scheduleJob(trigger);
}
} catch (SchedulerException e) {
e.printStackTrace();
}
return key.toString();
}
示例6: stopNow
import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Transactional(rollbackFor = Exception.class)
public void stopNow(Integer id) {
JobDetailDO jobDetailDO = daoSupport.get(id, JobDetailDO.class);
if (Objects.isNull(jobDetailDO) || jobDetailDO.getState().intValue() != 1) {
throw new BusinessException(ExceptionEnum.FAIL);
}
//先保留原狀態,原表達式。
Integer origState = jobDetailDO.getState();
String origCron = jobDetailDO.getCron();
//調用任務處理service,刪除job。
jobDetailDO.setState(2);
try {
initJobService.deleteJob(jobDetailDO);
} catch (SchedulerException e) {
e.printStackTrace();
throw new BusinessException(ExceptionEnum.FAIL);
}
//增加操作記錄
JobDetailEditAO jobDetailEditAO = buildJobDetailEditAO(origState, origCron, JobDetailEditTypeEnum.DELETE.getCode(), jobDetailDO);
jobDetailEditNotesService.addEditNote(jobDetailEditAO);
}
示例7: unScheduleJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* Remove the indicated Trigger from the scheduler.
* If the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.
*/
@Override
public boolean unScheduleJob(String jobName) {
System.out.println("Request received for Unscheduleding job.");
String jobKey = jobName;
TriggerKey tkey = new TriggerKey(jobKey);
System.out.println("Parameters received for unscheduling job : tkey :"+jobKey);
try {
boolean status = schedulerFactoryBean.getScheduler().unscheduleJob(tkey);
System.out.println("Trigger associated with jobKey :"+jobKey+ " unscheduled with status :"+status);
return status;
} catch (SchedulerException e) {
System.out.println("SchedulerException while unscheduling job with key :"+jobKey + " message :"+e.getMessage());
e.printStackTrace();
return false;
}
}
示例8: deleteJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* Delete the identified Job from the Scheduler - and any associated Triggers.
*/
@Override
public boolean deleteJob(String jobName) {
System.out.println("Request received for deleting job.");
String jobKey = jobName;
String groupKey = "SampleGroup";
JobKey jkey = new JobKey(jobKey, groupKey);
System.out.println("Parameters received for deleting job : jobKey :"+jobKey);
try {
boolean status = schedulerFactoryBean.getScheduler().deleteJob(jkey);
System.out.println("Job with jobKey :"+jobKey+ " deleted with status :"+status);
return status;
} catch (SchedulerException e) {
System.out.println("SchedulerException while deleting job with key :"+jobKey + " message :"+e.getMessage());
e.printStackTrace();
return false;
}
}
示例9: pauseJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* Pause a job
*/
@Override
public boolean pauseJob(String jobName) {
System.out.println("Request received for pausing job.");
String jobKey = jobName;
String groupKey = "SampleGroup";
JobKey jkey = new JobKey(jobKey, groupKey);
System.out.println("Parameters received for pausing job : jobKey :"+jobKey+ ", groupKey :"+groupKey);
try {
schedulerFactoryBean.getScheduler().pauseJob(jkey);
System.out.println("Job with jobKey :"+jobKey+ " paused succesfully.");
return true;
} catch (SchedulerException e) {
System.out.println("SchedulerException while pausing job with key :"+jobName + " message :"+e.getMessage());
e.printStackTrace();
return false;
}
}
示例10: resumeJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* Resume paused job
*/
@Override
public boolean resumeJob(String jobName) {
System.out.println("Request received for resuming job.");
String jobKey = jobName;
String groupKey = "SampleGroup";
JobKey jKey = new JobKey(jobKey, groupKey);
System.out.println("Parameters received for resuming job : jobKey :"+jobKey);
try {
schedulerFactoryBean.getScheduler().resumeJob(jKey);
System.out.println("Job with jobKey :"+jobKey+ " resumed succesfully.");
return true;
} catch (SchedulerException e) {
System.out.println("SchedulerException while resuming job with key :"+jobKey+ " message :"+e.getMessage());
e.printStackTrace();
return false;
}
}
示例11: resume
import org.quartz.SchedulerException; //導入方法依賴的package包/類
@RequestMapping(value = ACTION_RESUME)
public String resume(HttpServletRequest request,
HttpServletResponse response) {
try {
String jobKeys = request.getParameter("id");
if (null != jobKeys) {
service.iQuartzScheduleService.resume(jobKeys);
}
} catch (SchedulerException e) {
e.printStackTrace();
}
return REDIRECT + VIEW_WIDGET + VIEW_QUARTZ + PAGE_LIST;
}
示例12: pause
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* 暫停單個定時任務
*
* @param strVal
* @return String
* @throws SchedulerException
*/
@Override
public String pause(String strVal) throws SchedulerException {
JobKey key = null;
try {
String[] jobKey = strVal.split("\\.");
if (jobKey.length > 0) {
key = JobKey.jobKey(jobKey[1], jobKey[0]);
scheduler.pauseJob(key);
}
} catch (SchedulerException e) {
e.printStackTrace();
}
return key.toString();
}
示例13: triggerJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
@Override
public ReturnT<String> triggerJob(int id) {
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
String group = String.valueOf(xxlJobInfo.getJobGroup());
String name = String.valueOf(xxlJobInfo.getId());
try {
XxlJobDynamicScheduler.triggerJob(name, group);
return ReturnT.SUCCESS;
} catch (SchedulerException e) {
e.printStackTrace();
return ReturnT.FAIL;
}
}
示例14: pauseJob
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* @Description:暫停一個任務
* @param jobName
* @param jobGroupName
*
*/
public static void pauseJob(String jobName, String jobGroupName) {
JobKey jobKey =JobKey.jobKey(jobName, jobName);
try {
Scheduler sched = gSchedulerFactory.getScheduler();
sched.pauseJob(jobKey);
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例15: getJobState
import org.quartz.SchedulerException; //導入方法依賴的package包/類
/**
* Get the current state of job
*/
public String getJobState(String jobName) {
System.out.println("JobServiceImpl.getJobState()");
try {
String groupKey = "SampleGroup";
JobKey jobKey = new JobKey(jobName, groupKey);
Scheduler scheduler = schedulerFactoryBean.getScheduler();
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobDetail.getKey());
if(triggers != null && triggers.size() > 0){
for (Trigger trigger : triggers) {
TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
if (TriggerState.PAUSED.equals(triggerState)) {
return "PAUSED";
}else if (TriggerState.BLOCKED.equals(triggerState)) {
return "BLOCKED";
}else if (TriggerState.COMPLETE.equals(triggerState)) {
return "COMPLETE";
}else if (TriggerState.ERROR.equals(triggerState)) {
return "ERROR";
}else if (TriggerState.NONE.equals(triggerState)) {
return "NONE";
}else if (TriggerState.NORMAL.equals(triggerState)) {
return "SCHEDULED";
}
}
}
} catch (SchedulerException e) {
System.out.println("SchedulerException while checking job with name and group exist:"+e.getMessage());
e.printStackTrace();
}
return null;
}