简体   繁体   中英

Java 8 - Quartz Scheduler to schedule task for specific time daily

I want to execute a set of tasks and am using Quartz Scheduler. Right now, I am executing the task every 10 minutes, but I want to execute the task for the specific time on a daily basis.

For example, I want to execute the task at 8 am daily.

Below is my Quartz Scheduler code:

public void start() {
    try {
        scheduler = new StdSchedulerFactory().getScheduler();
        scheduler.start();
        schedule(DocumentIndexing.class, "0 0/10 * * * ?");
    } catch (Exception e) {
        System.out.println(e);
    }
}

you can generate the expression here:

Cron Expression Generator & Explainer - Quartz

for instance, I've generated a expression for execution every day at 8am 0 0 8 ? * * * 0 0 8 ? * * *

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM