quartzÒ»·ÖÖÓ½Ì³Ì javaÈÎÎñµ÷¶È
quartzÊǸÉɶµÄ£¿ ÈÎÎñµ÷¶ÈÓõÄ
ÈÎÎñµ÷¶ÈÊǸÉɶµÄ£¿¾ÍÊÇÔÚÔ¤¶¨µÄʱ¼ä×öÔ¤¶¨µÄÊÂ
1.ÔÚquartÍøÕ¾ÏÂ×îеÄJAR°ü
2.½¨¸öÏîÄ¿£¬°ÑquartzµÄJAR°ü¼ÓÈëµ½ÏîÄ¿
3.н¨Ò»¸öÈÎÎñ
public class MyJob implements org.quartz.Job {
@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
System.out.println("ÎÒ±»µ÷ÓÃÁË");
}
}
4.¿ªÆôÈÎÎñ£º
public class StartSchedule {
public static void main(String[] args) throws Exception {
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
JobDetail job = new JobDetail("job1", "group1", MyJob.class);
CronTrigger t = new CronTrigger("trigger1", "group1", "job1", "group1", "0/2 * * * * ?");
sched.scheduleJob(job, t);
sched.start();
Thread.sleep(500000);
sched.shutdown(true);
}
}
5.ÔËÐÐStartSchedule¼´¿É
ÆäÖУº
"0/2 * * * * ?" ÊÇcronExpression±í´ïʽ
Ò»¹²ÓÐ7×éÊý¾Ý×é³É£¬Î»Óëλ֮¼äÓÿռä·Ö¸ô
·Ö±ð´ú±í “Ãë ·Ö Ê± ÈÕ Ô ÖÜ Äê” ÆäÖÐÄêÊÇ¿ÉÒÔÊ¡ÂԵģ¬ËùÒÔÔÚÀý×ÓÖÐÓÃÁË6×é
¹Ù·½µÄÀý×Ó£º
Examples
Here are some full examples:
Expression
Meaning
0 0 12 * * ?
Fire at 12pm (noon) every day
0 15 10 ? * *
Fire at 10:15am every day
0 15 10 * * ?
Fire at 10:15am every day
0 15 10 * * ? *
Fire at 10:15am every day
0 15 10 * * ? 2005
Fire at 10:15am every day during the year 2005
0 * 14 * * ?
Fire every minute starting at 2pm and ending at 2:59pm, every day
0 0/5 14 * * ?
Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day
0 0/5 14,18 * * ?
Fire every 5 minutes starting at 2pm and
ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending
at 6:55pm, every day
0 0-5 14 * * ?
Fire every minute starting at 2pm and ending at 2:05pm, every day
0 10,44 14 ? 3 WED
Fire at 2:10pm and at 2:44pm every Wednesday in the month of March.
0 15 10 ? * MO
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Â¥Ö÷·¢±íÓÚ£º2008-06-17 15:26:20
l JBS
1.Áоٳö 10¸öJAVAÓïÑÔµÄÓÅÊÆ
a:Ãâ·Ñ£¬¿ªÔ´£¬¿çƽ̨(ƽ̨¶ÀÁ¢ÐÔ)£¬¼òµ¥Ò×Ó㬹¦ÄÜÍêÉÆ£¬ÃæÏò¶ÔÏ󣬽¡×³ÐÔ£¬¶àỊ̈߳¬½á¹¹ÖÐÁ¢£¬ÆóÒµÓ¦ÓõijÉÊìƽ̨, ÎÞÏßÓ¦ÓÃ
2.ÁоٳöJAVAÖÐ10¸öÃæÏò¶ÔÏó±à³ÌµÄÊõÓï
a:°ü£¬À࣬½Ó¿Ú£¬¶ÔÏó£¬ÊôÐÔ£¬·½·¨£¬¹¹ÔìÆ÷ ......
javaµÄд·¨
/**
*
* @param location
* @param nameList±£´æ½á¹ûµÄ£¡
*/
public void listDict(String location, List<String> nameList) {
File fileList = new File(location);
if (fileList.isDirectory()) {
File[] files = fileList.listFiles();
for (File f : files) {
i ......
×î½üµÄDevoxx´ó»áÉÏ£¬Java 7½«°üº¬±Õ°üµÄÏûÏ¢ÁîºÜ¶àÈ˸е½Õñ·Ü——Õ⽫×öΪһ¸ö¶ÀÁ¢µÄJSR±»ÊµÏÖ¡£ÔÚÖÚ¶àJava 7еÄÓïÑÔÌØÐÔÖУ¬ÓÐһЩÏÖÔÚÒѾÍê³ÉÁË¡£Devoxx´ó»áµÄһλ²Î»áÕßÔÚ²©¿ÍÖб¨¸æÁËÏÂÃæÕâЩJava 7ÒѾÍê³ÉµÄ7´óй¦ÄÜ£º
1£©¶Ô¼¯ºÏÀàµÄÓïÑÔÖ§³Ö£»
2£©×Ô¶¯×ÊÔ´¹ÜÀí£»
3£©¸Ä½øµÄͨÓÃʵÀý´´½¨ÀàÐÍÍ ......
/**
SimpleDateFormatº¯ÊýÓï·¨£º
G Äê´ú±êÖ¾·û
y Äê
M ÔÂ
d ÈÕ
h ʱ ÔÚÉÏÎç»òÏÂÎç (1~12)
H ʱ ÔÚÒ»ÌìÖÐ (0~23)
m ·Ö
s Ãë
S ºÁÃë
E ÐÇÆÚ
D Ò»ÄêÖеĵڼ¸Ìì
F Ò»ÔÂÖеڼ¸¸öÐÇÆÚ¼¸
w Ò»Äê ......