Lesson 1: Using Quartz
来源:互联网 发布:php在线升级原理 编辑:程序博客网 时间:2024/06/06 09:34
Lesson 1: Using Quartz 课程1:Quartz的使用
Before you can use the scheduler, it needs to be instantiated (who’d have guessed?). To do this, you use a SchedulerFactory. Some users of Quartz may keep an instance of a factory in a JNDI store, others may find it just as easy (or easier) to instantiate and use a factory instance directly (such as in the example below).
可以使用调度程序之前,它需要被初始化(谁能想不到呢?)。初始化,你使用SchedulerFactory。
Once a scheduler is instantiated, it can be started, placed in stand-by mode, and shutdown. Note that once a scheduler is shutdown, it cannot be restarted without being re-instantiated. Triggers do not fire (jobs do not execute) until the scheduler has been started, nor while it is in the paused state.
Here’s a quick snippet of code, that instantiates and starts a scheduler, and schedules a job for execution:
SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory(); Scheduler sched = schedFact.getScheduler(); sched.start(); // define the job and tie it to our HelloJob class JobDetail job = newJob(HelloJob.class) .withIdentity("myJob", "group1") .build(); // Trigger the job to run now, and then every 40 seconds Trigger trigger = newTrigger() .withIdentity("myTrigger", "group1") .startNow() .withSchedule(simpleSchedule() .withIntervalInSeconds(40) .repeatForever()) .build(); // Tell quartz to schedule the job using our trigger sched.scheduleJob(job, trigger);
As you can see, working with quartz is rather simple. In Lesson 2 we’ll give a quick overview of Jobs and Triggers, and Quartz’s API so that you can more fully understand this example.
- Lesson 1: Using Quartz
- Tutorial Lesson 1: Using Quartz
- Quartz.NET教程_Lesson 1: Using Quartz
- Lesson 12 Using block operations
- 【2】Using Quartz
- Lesson 1
- Lesson 1
- lesson 1
- lesson 1
- lesson 1
- Lesson 1
- Lesson 2: The Quartz API, Jobs And Triggers
- Quartz.NET教程_Lesson 11&Lesson 12(完)
- Asp JavaScript 教程 - Lesson 04 Using VBScript with JavaScriptor
- Lesson 07: Using Stored Procedures(使用存储过程)
- [English Homwork] Make 10 sentences by using new lesson words
- LESSON 1 -part 1
- Lesson 1 Excuse me!
- TransactionException: Error configuring AutoCommit
- 数据结构——插入排序
- 初识 FineReport 帆软
- ListView 各行变色写法
- iOS UITextFieldDelegate 代理方法小结
- Lesson 1: Using Quartz
- 各种第三方的分享
- Behavior子类SwipeDismissBehavior简单分析
- Laravel框架异步队列配置流程
- andorid 中android:id="@+id/btn"跟android:id="@android:id/tabhost" 区别
- linux内核部件--通用双向链表list
- 优秀博客
- Potato项目文档(2)
- Arm平台 Qt检测U盘插拔(三)hotplug-recv()阻塞