网站建设 流程,郑州网站排名分析,建设工程人才招聘信息网站,wordpress设计笔记我在Java中使用Quartz Scheduler来运行cron作业 . 这是我第一次使用这个框架来运行cron作业#xff0c;所以我有些困惑 .我正在关注这个tutorial以更好地理解如何使用Quartz框架 .我想每周和每个月都运行 JobA 所以我从基本的例子开始 -这是我到目前为止的例子 .public class …我在Java中使用Quartz Scheduler来运行cron作业 . 这是我第一次使用这个框架来运行cron作业所以我有些困惑 .我正在关注这个tutorial以更好地理解如何使用Quartz框架 .我想每周和每个月都运行 JobA 所以我从基本的例子开始 -这是我到目前为止的例子 .public class JobA implements Job {Overridepublic void execute(JobExecutionContext context)throws JobExecutionException {System.out.println(Job A is runing);// print whether it is week or month}}下面是我的CronTriggerExample它安排要运行的作业public class CronTriggerExample {public static void main(String[] args) throws Exception {JobKey jobKeyA new JobKey(jobA, group1);JobDetail jobA JobBuilder.newJob(JobA.class).withIdentity(jobKeyA).build();Trigger trigger1 TriggerBuilder.newTrigger().withIdentity(dummyTriggerName1, group1).withSchedule(CronScheduleBuilder.cronSchedule(5 8 * * 6 ?)).build();Scheduler scheduler new StdSchedulerFactory().getScheduler();scheduler.start();scheduler.scheduleJob(jobA, trigger1);}}Problem Statement:-我不知道如何使用上面的代码每周和每月运行JobA . 在我的案例中一周和一个月的cron标签条目是什么我不想在晚上8点到凌晨5点之间运行任何工作任何随机日都可以 .如果JobA每周都在运行那么它应该打印出 one-week 和 report_week . 但是如果JobA每个月都在运行那么它应该打印 one-month 和 report_one_month 所以接下来的问题是 - 有什么办法我们可以在尝试运行时将参数传递给JobA吗