当前位置:网站首页>Quartz (timer)
Quartz (timer)
2022-06-27 09:33:00 【Sparkle_ wsl】
Quartz( Timer )
Use steps
Guide pack
<!-- Clean up regularly jar package --> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> </dependency> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz-jobs</artifactId> </dependency>Customize a Job( Scheduled tasks )
public class ClearImg { @Autowired private JedisPool jedisPool; public void clearImg(){ System.out.println(jedisPool); // Put all the contents Set<String> set = jedisPool.getResource().sdiff(RedisConstant.SETMEAL_PIC_RESOURCES, RedisConstant.SETMEAL_PIC_DB_RESOURCES); if(set!=null){ // Call the delete method for (String s : set) { QiniuUtils.deleteFileFromQiniu(s); // eliminate redis Junk pictures in jedisPool.getResource().srem(RedisConstant.SETMEAL_PIC_RESOURCES,s); } } } }Accessories Spring-jobs Configuration file for
Will make it up to you job Configuration to Spring in
<!-- Register custom Job --> <bean id="jobDemo" class="com.itheima.jobs.ClearImg"></bean>register JobDetail, The action is responsible for invoking the specified through reflection job
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!-- Inject the target object --> <property name="targetObject" ref="jobDemo"/> <!-- Inject target method --> <property name="targetMethod" value="clearImg"/> </bean>Register a trigger , Specify when the task is triggered
<bean id="myTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <!-- Inject JobDetail That is, who will execute --> <property name="jobDetail" ref="jobDetail"/> <!-- Specify the trigger time , be based on Cron expression Specify how often --> <property name="cronExpression"> <value>0 0 0/1 * * ? </value> </property> </bean>Register a unified dispatching factory , Through this scheduling factory, scheduling tasks
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- Inject multiple triggers --> <property name="triggers"> <list> <!-- trigger 1 --> <ref bean="myTrigger"/> <!-- trigger 2 --> <res bean="xXX"> <!-- .... --> </list> </property> </bean>
Cron expression
Altogether 7 position , What is often used is 6 position
From right to right : second branch when Japan Zhou year
Online generation Cron expression
边栏推荐
- Several cases that do not initialize classes
- 反编译jar包,修改后重新编译为jar包
- Analysis of key technologies for live broadcast pain points -- second opening, clarity and fluency of the first frame
- How do I get the STW (pause) time of a GC (garbage collector)?
- Brief introduction to SSL encryption process
- i=i++;
- 了解神经网络结构和优化方法
- Installation and usage of source insight tool
- Semi-supervised Learning入门学习——Π-Model、Temporal Ensembling、Mean Teacher简介
- I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
猜你喜欢

1098 Insertion or Heap Sort(堆排序解释)(PAT甲级)
![文件名设置导致writelines写入报错:OSError: [Errno 22] Invalid argument](/img/08/2d4f425e6941af35616911672b6fed.png)
文件名设置导致writelines写入报错:OSError: [Errno 22] Invalid argument

Process 0, process 1, process 2

Digital ic-1.9 understands the coding routine of state machine in communication protocol

Installation and use of SVN version controller

基于STM32设计的蓝牙健康管理设备

Quick start CherryPy (1)

有关二叉树的一些练习题

经典的一道面试题,涵盖4个热点知识

QT运行显示 This application failed to start because it could not find or load the Qt platform plugin
随机推荐
QT运行显示 This application failed to start because it could not find or load the Qt platform plugin
Source insight 工具安装及使用方法
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Several cases that do not initialize classes
[system design] proximity service
openpyxl表格读取实例
有關二叉樹的一些練習題
多個類的設計
E+H二次表维修PH变送器二次显示仪修理CPM253-MR0005
Semi supervised learning—— Π- Introduction to model, temporary assembling and mean teacher
es 根据索引名称和索引字段更新值
js的数组拼接「建议收藏」
Tips for using Jupiter notebook
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Win10 add right-click menu for any file
This, constructor, static, and inter call must be understood!
How much memory does the data type occupy? LongVsObject
高等数学第七章微分方程
Object含有Copy方法?
微信小程序学习之五种页面跳转方法.