In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the difference between CronTrigger and SimpleTrigger". In daily operation, I believe many people have doubts about the difference between CronTrigger and SimpleTrigger. The editor consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "the difference between CronTrigger and SimpleTrigger"! Next, please follow the small series to learn together!
CronTriggers tend to be more useful than SimpleTrigger if you need a calendar based concept, rather than SimpleTrigger completely specifying time intervals, for recurring firing schedules to work on. CronTrigger, you can specify the schedule of triggers such as "every Friday at noon," or "every weekday at 9:30," or even "every 5 minutes at 9:00 and 10:00 every Monday morning, Wednesday Friday." Even so, like SimpleTrigger, CronTrigger has a startTime that specifies when the schedule takes effect, and an (optional) end time that specifies when the schedule should stop.
Cron Expressions
The cron expression is used to configure the CronTrigger instance. The cron expression is a string of characters, which is actually a timetable made up of seven subexpressions describing individual details. These subexpressions are separate blanks representing:
Seconds
Minutes
Hours
Day-of-Month
Month
Day-of-Week
Year (optional field)
Example: 0 0 12. * WED"is performed every Wednesday at 12:00 p.m.
Individual subexpressions can contain ranges, for example, in the previous example ("WED") can be replaced with "MON-FRI, ""MON, WED, FRI" or even "MON-WED,SAT."
"*" represents the entire time period.
Each field has a set of valid values that can be specified, such as
Seconds: can be represented by the numbers 0-59,
Minutes: can be represented by numbers 0-59,
Hours: can be represented by the numbers 0-23,
Day-of-Month: Any number from 1 to 31 can be used, but pay attention to special months.
Month: can be represented by 0-11 or by the string "JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV and DEC"
Day-of-Week: can be represented by the numbers 1-7 (1 = Sunday) or by the string "SUN, MON, TUE, WED, THU, FRI and SAT"
"/": special unit, expressed as "every" e.g."0/15" means to execute every 15 minutes,"0" means to start from "0" minute, "3/20" means to execute every 20 minutes,"3" means to execute from the 3rd minute
"? A day of the month or week
"L": used for monthly, or weekly, to indicate the last day of the month, or the last day of the week of each month, as in "6L" for "the last Friday of the month"
"W": represents the nearest working day, for example,"15W" is placed on the day-of-month field to represent "the nearest working day to the 15th of this month"
The nth weekday of the month, for example, day-of-week. If the field contains "6#3" or "FRI#3", it means "the third Friday of the month"
1) Format of Cron expression: seconds, minutes, hours, days, months, weeks, years (optional).
field name allowed values Permitted special characters seconds 0-59 , - * / points 0-59 , - * / hours 0-23 , - * / on 1-31 , - * ? / L W C months 1-12 or JAN-DEC , - * / what day is 1-7 or SUN-SAT , - * ? / L C # Year (optional field) empty, 1970-2099 , - * / "? "Character: Indicates an indeterminate value "," character: specifies several values "-" character: Specify a range of values "/" character: Specifies how much to increase a value. n/m means starting with n and increasing m at a time "L" character: in the day to indicate the last day of the month, in the week to indicate the last week of the month X "W" character: Specifies the weekday closest to the given date (Monday through Friday) "#" character: indicates the week X of the month. #3 means the third Friday of the month. 2) Examples of Cron expressions: Every 5 seconds: */5 * * * * ? Every minute: 0 */1 * * * ? Once a day at 23:00:00 * * ? Once a day at 1 a.m.: 0 0 1 * * ? Once a month at 1 a.m.: 0 0 1 * ? Once at 23:00 on the last day of each month: 0 0 23 L * ? Once a week at 1 a.m. on Sunday: 0 0 1 ? * L Once at 26, 29, 33:0 26, 29, 33 * * * ? Every day at 0:00, 13:00, 18:00 and 21:00:00, 0:00, 0, 0:00, 0, 0:00, 0, 0 At this point, the study of "the difference between CronTrigger and SimpleTrigger" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.