java调度器 quartz

几个关键对象:

Scheduler - the main API for interacting with the scheduler.
Job - an interface to be implemented by components that you wish to have executed by the scheduler.
JobDetail - used to define instances of Jobs.
Trigger - a component that defines the schedule upon which a given Job will be executed.
JobBuilder - used to define/build JobDetail instances, which define instances of Jobs.
TriggerBuilder - used to define/build Trigger instances.

在网上看到很多jobdetail class,自己下的2.2版本的是interface。
另外job类一定要是public否则会报错,因为内部会通过反射区newinstance个对象
job类不能是内部类,
setRepeatCount 如果不设定,job会默认执行一次,另外设定为-1为无限次

如果计划的时间比较复杂可以用crontrigger,里面的表达式和shell差不多。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值