zoukankan      html  css  js  c++  java
  • quartz2.1.3+spring3.2.18.RELEASE 实现spring整合quartz第二天

    spring 对应的配置

     <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
            <property name="dataSource" ref ="dataSource" />
            <property name="applicationContextSchedulerContextKey" value="applicationContextKey"/>
            <property name="configLocation" value="classpath:properties/quartz.properties"/>
        </bean>

    顺便记录一下初始化加载bean ,,这个在properties文件加载之后执行

    <bean id="initAccessTokenService" class="com.bms.webchat.commom.handler.InitAccessTokenService"></bean>

     还有就是quartz.properties文件说明

    # Default Properties file for use by StdSchedulerFactory
    # to create a Quartz Scheduler Instance, if a different
    # properties file is not explicitly specified.
    #
    
    #============================================================================
    # Configure Main Scheduler Properties
    #============================================================================这个和spring配置的beanid一致
    org.quartz.scheduler.instanceName: quartzScheduler
    org.quartz.scheduler.instanceId = AUTO
    
    org.quartz.scheduler.rmi.export: false
    org.quartz.scheduler.rmi.proxy: false
    org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
    #============================================================================
    # Configure ThreadPool
    #============================================================================
    org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount: 2
    org.quartz.threadPool.threadPriority: 5
    org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
    
    org.quartz.jobStore.misfireThreshold: 60000
    #============================================================================
    # Configure JobStore
    #============================================================================
    
    #default config
    #org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
    #持久化配置
    org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX
    org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate
    org.quartz.jobStore.useProperties:true
    org.quartz.jobStore.selectWithLockSQL=SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?
    #============================================================================
    #havent cluster spring
    #============================================================================
    org.quartz.jobStore.isClustered = false  
    
    #数据库表前缀
    org.quartz.jobStore.tablePrefix:qrtz_
    #org.quartz.jobStore.dataSource:qzDS
    
    #============================================================================
    # Configure Datasources
    #============================================================================
    #JDBC驱动  Sping去管理dataSource ,这里不在配置数据源信息
    #org.quartz.dataSource.qzDS.driver:com.mysql.jdbc.Driver
    #org.quartz.dataSource.qzDS.URL:jdbc:mysql://localhost:3306/quartz_test
    #org.quartz.dataSource.qzDS.user:root
    #org.quartz.dataSource.qzDS.password:root
    #org.quartz.dataSource.qzDS.maxConnection:10

    需要做定时作业的类需集成job接口 

    package com.bms.aa
    
    import org.quartz.Job;
    import org.quartz.JobExecutionContext;
    import org.quartz.JobExecutionException;
    
    import com.bms.commom.util.a;
    
    public class bimplements Job{
        @Override
        public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
            a.c();
        }
    }

    最后说一下这个时间设置   

    0 0 */1 * * ?  代表一小时执行一次   

    0/30 * * * * ?代表30秒执行一次

    *代表

    这个应该是秒 分 时 天 月?    *  *  *  *  * ?

    http://cron.qqe2.com/

    到这里基本算完成了,剩下就是做页面,可视化了。

  • 相关阅读:
    Linux chattr 文件保护
    ArcGIS案例学习笔记-批处理擦除挖空挖除相减
    ArcGIS案例学习笔记-手动编辑擦除挖空挖除相减
    GIS案例学习笔记-CAD数据分层导入现有模板实例教程
    GIS案例学习笔记-ArcGIS整图大图出图实例教程
    Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory
    [图解tensorflow源码] 入门准备工作附常用的矩阵计算工具[转]
    GIS案例学习笔记-明暗等高线提取地理模型构建
    地理处理模型、案例、教程、培训低价发送
    GIS工具-shp浏览器
  • 原文地址:https://www.cnblogs.com/soul113/p/10511476.html
Copyright © 2011-2022 走看看