本文整理匯總了Java中org.quartz.impl.matchers.GroupMatcher.anyJobGroup方法的典型用法代碼示例。如果您正苦於以下問題:Java GroupMatcher.anyJobGroup方法的具體用法?Java GroupMatcher.anyJobGroup怎麽用?Java GroupMatcher.anyJobGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.quartz.impl.matchers.GroupMatcher
的用法示例。
在下文中一共展示了GroupMatcher.anyJobGroup方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAllJob
import org.quartz.impl.matchers.GroupMatcher; //導入方法依賴的package包/類
/**
* 獲取所有計劃中的任務列表
*
* @return
* @throws SchedulerException
*/
public List<ScheduleJob> getAllJob() throws SchedulerException {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
Set<JobKey> jobKeys = scheduler.getJobKeys(matcher);
List<ScheduleJob> jobList = new ArrayList<ScheduleJob>();
for (JobKey jobKey : jobKeys) {
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
for (Trigger trigger : triggers) {
ScheduleJob job = new ScheduleJob();
job.setName(jobKey.getName());
job.setGroup(jobKey.getGroup());
job.setDescription("觸發器:" + trigger.getKey());
Trigger.TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
job.setStatus(triggerState.name());
if (trigger instanceof CronTrigger) {
CronTrigger cronTrigger = (CronTrigger) trigger;
String cronExpression = cronTrigger.getCronExpression();
job.setCron(cronExpression);
}
jobList.add(job);
}
}
return jobList;
}
示例2: getAllJobList
import org.quartz.impl.matchers.GroupMatcher; //導入方法依賴的package包/類
public List<ScheduleJob> getAllJobList(){
List<ScheduleJob> jobList = new ArrayList<>();
try {
GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
Set<JobKey> jobKeySet = scheduler.getJobKeys(matcher);
for (JobKey jobKey : jobKeySet){
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
for (Trigger trigger : triggers){
ScheduleJob scheduleJob = new ScheduleJob();
this.wrapScheduleJob(scheduleJob,scheduler,jobKey,trigger);
jobList.add(scheduleJob);
}
}
} catch (SchedulerException e) {
e.printStackTrace();
}
return jobList;
}
示例3: getTasks
import org.quartz.impl.matchers.GroupMatcher; //導入方法依賴的package包/類
public List<Task> getTasks() throws SchedulerException {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
Set<JobKey> jobKeys = scheduler.getJobKeys(matcher);
List<Task> taskList = new ArrayList<>();
for (JobKey jobKey : jobKeys) {
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
for (Trigger trigger : triggers) {
Task task = new Task();
task.setJobGroup(jobKey.getGroup());
task.setJobName(jobKey.getName());
if (trigger instanceof SimpleTrigger) {
SimpleTrigger simpleTrigger = (SimpleTrigger) trigger;
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
task.setDescription(jobDetail.getDescription());
if (simpleTrigger.getRepeatCount()<1) {
task.setProgress(0.0);
} else {
if (jobDetail.getJobDataMap().get("overallCounter")!= null) {
Double progress = Double.parseDouble(jobDetail.getJobDataMap().get("overallCounter").toString());
task.setProgress((progress/simpleTrigger.getRepeatCount() * 100));
} else {
task.setProgress(0.0);
}
}
}
taskList.add(task);
}
}
return taskList;
}
示例4: getPlanJobList
import org.quartz.impl.matchers.GroupMatcher; //導入方法依賴的package包/類
@Override
public List<ScheduleJobEntity> getPlanJobList() {
List<ScheduleJobEntity> jobList = new ArrayList<>();
Scheduler scheduler = schedulerFactoryBean.getScheduler();
try {
GroupMatcher<JobKey> matcher = GroupMatcher.anyJobGroup();
Set<JobKey> jobKeySet = scheduler.getJobKeys(matcher);
for (JobKey jobKey : jobKeySet) {
/*
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
for (Trigger trigger : triggers) {
ScheduleJobEntity scheduleJob = new ScheduleJobEntity();
this.wrapScheduleJob(scheduleJob, scheduler, jobKey, trigger);
jobList.add(scheduleJob);
}
*/
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
ScheduleJobEntity scheduleJob = new ScheduleJobEntity();
scheduleJob.setJobName(jobKey.getName());
scheduleJob.setJobGroup(jobKey.getGroup());
scheduleJob.setJobClassName(jobDetail.getJobClass().getName());
scheduleJob.setJobDesc(jobDetail.getDescription());
jobList.add(scheduleJob);
}
} catch (SchedulerException e) {
logger.error("獲取計劃任務列表失敗", e);
throw new ServiceException("獲取計劃任務列表失敗", e);
}
return jobList;
}
示例5: jobs
import org.quartz.impl.matchers.GroupMatcher; //導入方法依賴的package包/類
@Override
public Collection<JobDetailInfo> jobs() throws SchedulerException {
List<JobDetailInfo> jobDetailInfoes = new ArrayList<>();
Scheduler scheduler = schedulerFactoryBean.getScheduler();
GroupMatcher<JobKey> jobMatcher = GroupMatcher.anyJobGroup();
Set<JobKey> jobKeys = scheduler.getJobKeys(jobMatcher);
for (JobKey jobKey : jobKeys) {
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobKey);
for (Trigger trigger : triggers) {
JobDetailInfo jobDetailInfo = new JobDetailInfo();
jobDetailInfo.setJobName(jobKey.getName());
jobDetailInfo.setJobGroupName(jobKey.getGroup());
jobDetailInfo.setJobDescription(jobDetail.getDescription());
jobDetailInfo.setJobClassName(jobDetail.getJobClass().getName());
jobDetailInfo.setTriggerName(trigger.getKey().getName());
jobDetailInfo.setTriggerGroupName(trigger.getKey().getGroup());
jobDetailInfo.setTriggerDescription(trigger.getDescription());
CronTrigger cronTrigger = (CronTrigger) trigger;
jobDetailInfo.setTriggerCronExpression(cronTrigger.getCronExpression());
jobDetailInfo.setStartTime(new DateTime(trigger.getStartTime()).toString("yyyy-MM-dd HH:mm:ss"));
jobDetailInfo.setEndTime(new DateTime(trigger.getEndTime()).toString("yyyy-MM-dd HH:mm:ss"));
jobDetailInfo
.setFinalFireTime(new DateTime(trigger.getFinalFireTime()).toString("yyyy-MM-dd HH:mm:ss"));
jobDetailInfo.setPreviousFireTime(
new DateTime(trigger.getPreviousFireTime()).toString("yyyy-MM-dd HH:mm:ss"));
jobDetailInfo.setNextFireTime(new DateTime(trigger.getNextFireTime()).toString("yyyy-MM-dd HH:mm:ss"));
jobDetailInfo.setMisfireInstruction(trigger.getMisfireInstruction());
TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());
jobDetailInfo.setJobState(triggerState.name());
jobDetailInfoes.add(jobDetailInfo);
}
}
return jobDetailInfoes;
}