Misfire Characteristics of quartz

Source: Internet
Author: User

Misfire Characteristics of quartz Only one thread, multiple jobs The first job produces misfire (Executetime>interval) and is RepeatForever then only the first job is run, and all the jobs behind will not run the first job produces misfire ( Executetime>interval) and is Withrepeatcount (N), by default (Withmisfirehandlinginstructionnowwithexistingcount), The second job executes after the first job is executed; But if the second job corresponds to the trigger set to: Withmisfirehandlinginstructionnextwithexistingcount Or Withmisfirehandlinginstructionnextwithremainingcount then the second job will never execute, because schedule calculates the finaltime of each job at the outset ( By calling the Getfinalfiretime () method of the trigger), the time is no longer executed, but if the execution of JOB2 is not over its finaltime, the system will execute JOB2, but eventually The resulting execution count will be less than the Withrepeatcount defined by JOB2
n Threads, m jobs if each job is misfire (Executetime>interval) and is RepeatForever, the system executes only the first n jobs, and the latter job does not execute
If the task is still in execution at the point of execution, but there is an idle thread, then it will be executed immediately, so that the same job will be executed in parallel; many times we prohibit this, in order to prohibit the job to run concurrently at the same time, the job class needs to be tagged:
@DisallowConcurrentExecution
Quartz has a global parameter Misfirethreshold setting can allow the time-out to be exceeded without executing, not exceeding on execution. For example, set misfirethreshold=30 minutes, if a task timed at 10:30, but at 10:29 server hangs, at 10:50 start, although the task timeout of 21 minutes, but less than misfirethreshold, so still can be executed. And if the server does not start 11:10, then it is misfire.
For recurring tasks, if there is a misfire situation, the Crontrigger time period is automatically updated by default, the previous misfire task is executed immediately at the current time and if set Misfire_instruction_do_ Nothing, special handling is not performed on misfire tasks, only starting from the next normal scheduled time after the current time
The prerequisites for generating misfire are:
The previous execution was not completed when the trigger was executed, and no idle thread in the thread pool can be used (or there are idle threads available but the job is set to @disallowconcurrentexecution) and the expiration time has exceeded misfirethreshold
Satisfying the above conditions will trigger the misfire of quartz; If there are multiple processing strategies for generating Misfire,quartz:
Here are the different misfire strategies that correspond to various Triigger Crontrigger
withmisfirehandlinginstructiondonothing--does not trigger immediate execution-waits for the next cron trigger frequency to start at the cron frequency
withmisfirehandlinginstructionignoremisfires--begins execution immediately at the first frequency time missed-after all frequency cycles missed-after the next trigger frequency is greater than the current time, Then follow the normal cron frequency in sequence.
Withmisfirehandlinginstructionfireandproceed (default)--triggers the execution immediately at the current time--and then executes sequentially according to the Cron frequency
Simpletrigger
withmisfirehandlinginstructionfirenow--immediately triggers execution at the current time as the trigger frequency-the number of remaining cycles to finaltime-the cycle frequency that is based on the time of dispatch or recovery schedule, Finaltime is calculated based on the number of remaining times and the current time-the adjusted finaltime is slightly larger than the Finaltime value calculated by StartTime
withmisfirehandlinginstructionignoremisfires--begins execution immediately at the first frequency time missed-all the frequency cycles that are missed-the next trigger frequency is greater than the current time, Execute the remaining frequency according to interval--repeatcount+1 times
withmisfirehandlinginstructionnextwithexistingcount--does not trigger immediate execution-waits for the next trigger frequency cycle time, the number of remaining cycles to finaltime-- The periodic frequency is calculated based on the StartTime, and the finaltime--is kept finaltime even if the middle appears pause,resume.
Withmisfirehandlinginstructionnowwithexistingcount (default)--triggers execution immediately at the current time--the number of remaining cycles to finaltime-- A periodic frequency based on the time of dispatch or recovery schedule, Finaltime calculated from the number of remaining times and the current time-the adjusted finaltime will be slightly larger than the Finaltime value calculated based on StartTime
withmisfirehandlinginstructionnextwithremainingcount--does not trigger immediate execution-waits for the next trigger frequency cycle time, the number of remaining cycles to finaltime-- The periodic frequency is calculated based on the StartTime, and the finaltime--is kept finaltime even if the middle appears pause,resume.
withmisfirehandlinginstructionnowwithremainingcount--immediate execution at the current time as the trigger frequency-the number of remaining cycles executed to Finaltime- A periodic frequency based on the time of dispatch or recovery schedule, Finaltime calculated according to the number of remaining times and the current time
--The adjusted finaltime will be slightly larger than the Finaltime value calculated according to the StartTime
misfire_instruction_reschedule_now_with_remaining_repeat_count--this directive causes trigger to forget the original settings of StartTime and repeat-count-- The repeat-count of the trigger will be set to the remaining number of times-this will result in the subsequent inability to get the original set of StartTime and Repeat-count values
Http://blog.sina.com.cn/s/blog_613904cc0101gajk.html http://my.oschina.net/chenleijava/blog/109904
Good:http://hedatou.com/archives/introduction_to_quartz.html above the state and quartz-1.8.4: http://www.ibm.com/ developerworks/cn/opensource/os-cn-quartz/: Cron Status: Misfire_instruction_fire_once_now: Misfire_instruction_ Smart_policy misfire_instruction_do_nothing Simple state, Misfire_instruction_smart_policy according to different repeatcount will have different corresponding results: MISFIRE_INSTRUCTION_FIRE_NOW:MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT:MISFIRE_INSTRUCTION_ Reschedule_now_with_existing_repeat_count:

Misfire Characteristics of quartz

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.