In addition to using the simplest simple trigger in quartz, you can run the job in a way similar to the crontrigger of cron jobs on Linux, here's a small example:1. First is a task class, which does not implement any interface, which contains a run method for running the task, the code is as follows:[Java]View Plaincopyprint?
Package Org.garbagecan.springstudy.schedule.quartz;
Public class MyTask {
Address: http://blog.csdn.net/kongxx/article/details/6751326
In addition to the simplest Simple Trigger in Quartz, you can run a Job in a way similar to CronTrigger of Cron jobs in Linux. Below is a small example:
1. First, it is a task class. This class does not implement any interfaces. It contains a run method used to run this task. The Code is as follows:
Package org. garbagecan. springstudy. schedule.
Time expression setting in quartz ----- corn expression
Time Format:
Example:
1. When to run every day:
2. Run at intervals of time:
Summary:
In addition to agreeing to set a value, the time field of the cron expression can also use some special characters to provide f
" parameter, do not specify a list or range, as this can cause problems
Field
allowed
special characters for
allowable values
秒
0-59
, - * /
分
0-59
, - * /
小时
0-23
, - * /
日期
1-31
, - * ? / L W C
月份
1-12或者 JAN-DEC
, - * /
星期
1-7或者 SUN-SAT
, - * ? /
This article address: http://blog.csdn.net/kongxx/article/details/6751326
In addition to using the simplest simple trigger in quartz, you can run a job using a crontrigger like a cron job on Linux, and here's a small example:
1. The first is a task class, which does not implement any interfaces, and contains a run method to run the task, as follows:
Package Org.garbagecan.springstudy.schedule.quartz;
publ
Time expression setting in quartz ----- corn expression
Time Format:
Example:
1. When to run every day:
2. Run at intervals of time:
Summary:
In addition to agreeing to set a value, the time field of the cron expression can also use some special characters to provide f
Setting-----Corn expression for time expressions in quartz
Time format:
Example:
1. When to execute every day:
2. How often do you perform:
Summary description:
The time field of a cron expression, in addition to allowing the setting of numeric values, can also use some special characters, providing lists, scopes
W C
Month
1-12 or Jan-dec
,-*/
Week Date
1-7 or Sun-sat
,-*? /L C #
Year (optional)
Leave Blank, 1970-2099
,-*/
Cron Expression Special characters detailedThe next cron expression, I'll combine with q
Crontrigger
Crontriggers tend to be more useful than simpletrigger if you need a calendar-based concept, rather than simpletrigger a fully specified time interval, recurrence of the launch work schedule.Crontrigger, you can specify a trigger schedule such as "Every Friday noon", or "every weekday 9:30", or even "every 5 minutes 9:00 and 10:00 per Monday a.m., Wednesday Friday".Even so, like Simpletrigger, Crontrigger owns the starttime when the specified timesheet is in effect, and the specifie
In order ofSeconds (0~59)Minutes (0~59)Hours (0~23)Days (months) (0~31, but you need to consider the number of days of your month)Month (0~11)Days (weeks) (1~7 1=sun or Sun,mon,tue,wed,thu,fri,sat)7. Year (1970-2099)Each of these elements can be a value (such as 6), a continuous interval (9-12), a time interval (8-18/4) (/= every 4 hours), a list (1,3,5), and a wildcard character. Because the "date in the month" and "date in the week" are mutually exclusive, one of the two elements must be set.0
It programmer development Essentials-all kinds of resources download list, history of the most IT resources, personal collection summary.
Setting-----Corn expression for time expressions in quartz
Time format:
Example:
1. When to execute every day:
2. How often do you perform:
Summary description:
The time field of a cron
The setting of time expressions in quartz-----corn expressions
Time format:
Example:
1. When to execute every day:
2. How often to perform:
Summary description:
The time field of a cron expression allows you to set a numeric value, and you can use special characters to provide lists, ranges, wildcard characters, and so on, as follows:
Asterisk (*): Used in
The SPRINGMVC feature is powerful and integrates the functions of the quartz timer. The ability to perform scheduled tasks with cron expressions and simple annotations.See a lot of examples on the Internet, but are not very full.The gossip is seldom said. First, add the following lines to the Springmvc.xml: xmlns:task= "Http://www.springframework.org/schema/task"Http://www.springframework.org/schema/taskHtt
The SPRINGMVC feature is very powerful and integrates the functions of the quartz timer, which allows you to perform scheduled tasks with cron expressions and simple annotations.There are many examples on the internet, but they are not very whole.To talk less, first add the following lines to the Springmvc.xml: xmlns:task= "Http://www.springframework.org/schema/task"Http://www.springframework.org/schema/tas
The cron expression of quartz is in the order of seconds (0 ~ 59) minutes (0 ~ 59) hour (0 ~ 23) days (months) (0 ~ 31, but you need to consider the number of days of your month) month (0 ~ 11) Day (week) (1 ~ 7 1 = sun, Mon, Tue, wed, Thu, Fri, SAT) 7. year (1970-2099), where each element can be a value (for example, 6), a continuous interval (9-12), and an inte
This is a creation in
Article, where the information may have evolved or changed.
Go Timing Basic Instance Code
import ("log""github.com/robfig/cron")func main() {i := 0c := cron.New()spec := "0/5 * * * * ?"//var spec_ string = "*/5 * * * * ?"c.AddFunc(spec, func() {i++log.Println("cron running:", i)})c.AddFunc("@every 1h1m", func() {i++log.Println("cron running
What cron expressions Are: First Cron is a scheduled task, that is, a cron expression is typically used to configure the trigger time for a scheduled task. A cron expression is a string consisting of six or seven sub-expressions (
Crontriggers tend to be more useful than simpletrigger if you need a calendar-based concept, rather than simpletrigger a fully specified time interval, recurrence of the launch work schedule.Crontrigger, you can specify a trigger schedule such as "Every Friday noon", or "every weekday 9:30", or even "every 5 minutes 9:00 and 10:00 per Monday a.m., Wednesday Friday".Even so, like Simpletrigger, Crontrigger owns the starttime when the specified timesheet is in effect, and the specified timesheet s
One: First configure a timer in spring's configuration fileFixed-delay= "/>"fixed-delay= "300000"/>Cron= "0 0 4 * *?" /> scheduler= "Scheduler"/>Two: Write a timer class to handle your business logic@Service ("Synceventscheduler")public class Synceventscheduler {}A cron expression is a string of characters separated by 5 or 6 spaces, starting 6 or 7 fields, each
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.