quartz.properties基本配置说明
# org.quartz.scheduler.instanceName = SCHED_NAME
# org.quartz.scheduler.instanceId = INSTANCE_ID # org.quartz.scheduler.threadName = THREAD_NAME # org.quartz.scheduler.rmi.export = false # org.quartz.scheduler.rmi.proxy = false # org.quartz.scheduler.rmi.registryHost = localhost # org.quartz.scheduler.rmi.registryPort = 1099 # org.quartz.scheduler.rmi.createRegistry = never # org.quartz.scheduler.userTransactionURL = USER_TX_LOCATION # org.quartz.scheduler.wrapJobExecutionInUserTransaction = JOBS_IN_USER_TX # org.quartz.scheduler.idleWaitTime = IDLE_WAIT_TIME # org.quartz.scheduler.dbFailureRetryInterval = DB_FAILURE_RETRY_INTERVAL # org.quartz.scheduler.classLoadHelper.class = CLASS_LOAD_HELPER_CLASS # org.quartz.context.key.SOME_KEY = SOME_VALUE线程池配置说明
# org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
# org.quartz.threadPool.threadCount = THREAD_COUNT # org.quartz.threadPool.threadPriority = THREAD_PRIO # # 简单线程池(SimpleThreadPool)的选项参数: # # org.quartz.threadPool.makeThreadsDaemons = DAEMON_THREADS # org.quartz.threadPool.threadsInheritGroupOfInitializingThread = INHERIT_GRP # org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = INHERIT_LDR # # or # # org.quartz.threadPool.class = com.mycompany.goo.FooThreadPool # org.quartz.threadPool.somePropOfFooThreadPool = someValue任务存储配置(JobStore)说明
# 定义一个任务存储的一般模式如下:
# # org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore # org.quartz.jobStore.misfireThreshold = MISFIRE_THRESHOLD # # or # # org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.<JobStoreClass> # JobStoreClass 是下面其中的一个: # - JobStoreTX 用于单机(standalone-Quartz)实现 # - JobStoreCMT 用于基于应用服务器容器管理事务(appserver-based container-managed transaction )的Quartz 实现 # # org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.<DriverDelegateClass> # DriverDelegateClass 是下面其中的一个: # - StdJDBCDelegate (用于许多 JDBC-compliant drivers) # - MSSQLDelegate (用于 Microsoft SQL Server drivers) # - PostgreSQLDelegate (用于 PostgreSQL drivers) # - WebLogicDelegate (用于 WebLogic drivers) # - oracle.OracleDelegate (用于 Oracle drivers) # # org.quartz.jobStore.useProperties = USE_PROPERTIES # org.quartz.jobStore.dataSource = DS_NAME # org.quartz.jobStore.tablePrefix = TABLE_PREFIX # org.quartz.jobStore.isClustered = IS_CLUSTERED # org.quartz.jobStore.selectWithLockSQL = LOCKING_SELECT_STATEMENT # org.quartz.jobStore.dontSetAutoCommitFalse = DONT_TURN_OFF_AUTO_COMMIT # org.quartz.jobStore.maxMisfiresToHandleAtATime = MAX_MISFIRE_HANDLE # org.quartz.jobStore.txIsolationLevelSerializable = SERIALIZABLE_ISOLATION # # 如果你使用JobStoreCMT,你还需要下面的参数: # # org.quartz.jobStore.nonManagedTXDataSource = NON_MANAGED_TX_DS_NAME # # 并且如果你使用JobStoreCMT,下面的参数是可选的: # #org.quartz.jobStore.dontSetNonManagedTXConnectionAutoCommitFalse = DONT_TURN_OFF_AUTO_COMMIT # org.quartz.jobStore.txIsolationLevelReadCommitted = READ_COMMITTED_ISOLATION # # # 或者,使用一个用户自定义JobStore实现: # # org.quartz.jobStore.class = com.mycompany.goo.FooJobStore # org.quartz.jobStore.somePropOfFooJobStore = someValue数据源配置说明
# (只有当使用JDBCJobStore时需要, 或者一个插件需要JDBC)
# -- 如果你的Scheduler非常忙碌,比如在一定的线程池内执行相同数目的任务,那么你应让数据源的连接数等于线程数 + 1 # # 数据源定义的一般模式如下: # # org.quartz.dataSource.NAME.driver = DRIVER_CLASS_NAME # org.quartz.dataSource.NAME.URL = DB_URL # org.quartz.dataSource.NAME.user = DB_USER # org.quartz.dataSource.NAME.password = DB_PASSWORD # org.quartz.dataSource.NAME.maxConnections = DB_POOL_SIZE # org.quartz.dataSource.NAME.validationQuery= VALIDATION_QUERY # # or # # org.quartz.dataSource.NAME.jndiURL = DB_JNDI_URL # # or # org.quartz.dataSource.NAME.jndiURL = DB_JNDI_URL # org.quartz.dataSource.NAME.jndiAlwaysLookup = DB_JNDI_ALWAYS_LOOKUP # org.quartz.dataSource.NAME.java.naming.factory.initial = JNDI_CTXT_FACTORY # org.quartz.dataSource.NAME.java.naming.provider.url = JNDI_PROVIDER_URL # org.quartz.dataSource.NAME.java.naming.security.principal = JNDI_PRINCIPAL # org.quartz.dataSource.NAME.java.naming.security.credentials = JNDI_CREDENTIALS上面显示了两种数据源定义方式:一个数据源可以用给定的数据库连接信息创建,也可以是利用应用服务器管理生成的JNDI数据源的逻辑映射。
具体说明如下:
详情说明请访问:
简单配置示例如下:
#调度器名称(可以是任何字符串)org.quartz.scheduler.instanceName: quartzScheduler#调度器标识(可以是任何字符,但必须是唯一的,可设置AUTO通过调度器自动生成,也设置系统生成)org.quartz.scheduler.instanceId = AUTO#设置调度标识生成类;若instanceId 被设置成了AUTO后则默认为#org.quartz.simpl.SimpleInstanceIdGenerator;生成的规则为主机名和时间戳#还可以设置其他方式生成或实现自己生成标识类org.quartz.scheduler.instanceIdGenerator.class#调度器在rmi服务器下是否导出自己,默认值为falseorg.quartz.scheduler.rmi.export: false#是否远程连接调度器,默认值为false,不连接,若设置为ture的话,#还必须为RMI注册过程指定一个主机和端口——这通常是“localhost”端口1099org.quartz.scheduler.rmi.proxy: falseorg.quartz.scheduler.wrapJobExecutionInUserTransaction: false#============================================================================# 线程池配置#============================================================================#quartz线程池使用名称,设置成org.quartz.simpl.SimpleThreadPool,可满足所有基本需求org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool#线程池数量;具体可根据实际需求设定,设置太多的话则会产生线程加载缓慢及线程闲置org.quartz.threadPool.threadCount: 2#线程优先数量,最大数量为Thread.MAX_PRIORITY(10),默认值为Thread.NORM_PRIORITY(5)#其范围为:Thread.MIN_PRIORITY (which is 1) 到 Thread.MAX_PRIORITY (10)之间org.quartz.threadPool.threadPriority: 5#线程启动数量,是每次全部启动还是每次启动一个;设置false则每次启动单个org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true#最大能忍受的触发超时时间org.quartz.jobStore.misfireThreshold: 60000#============================================================================# Configure JobStore#============================================================================#org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX#quartz数据源驱动类配置org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate#org.quartz.jobStore.useProperties:true#============================================================================#havent cluster spring isClustered =启动集群模式#============================================================================#集群模式设置org.quartz.jobStore.isClustered = false #数据表前缀org.quartz.jobStore.tablePrefix:qrtz_
说明配置