本文整理汇总了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;
}