Note: Quartz StartNow () is invalid. quartzstartnow

Source: Internet
Author: User

Note: Quartz StartNow () is invalid. quartzstartnow

Today, a problem occurs. When the scheduler starts, it cannot start to execute the task immediately. The Code is as follows:

Var trigger = TriggerBuilder. Create (). StartNow () // This is invalid. WithCronSchedule ("0 0/30 10-20 **? "). Build ();

The StartNow () comment is as follows:

/// Summary: // Set the time the Trigger shocould start at to the current moment-the trigger // may or may not fire at this time-depending upon the schedule configured // for the Trigger. //// returned result: // the updated TriggerBuilderpublic TriggerBuilder StartNow ();

The search results on stockoverflow are as follows:

Address: http://stackoverflow.com/questions/19219560/quartz-trigger-builder-startnow-not-firing-the-trigger-during-the-start

It is learned from the above that when the Cron expression is used, the StartNow method does not have any effect, and Cron has its own execution time. Currently, StartNow should only apply to SimpleTrigger triggers.

Solution:

 

1. For example, add a trigger with only StartNow to immediately trigger a Job.

2. You can manually call and execute a Job once before scheduler. Start () is started.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.