java - 使用 lockoninsert=false 的集群模式下的 Quartz

标签 java quartz-scheduler

我的应用程序有 4 个节点。有时,我所有的作业都会卡住,等待来自“Select * from QRTZ_LOCKS where lock_name='TRIGGER_ACCESS' for update”的锁定

在阅读一些文章时,有人建议使用此属性关闭全局锁定

org.quartz.jobStore.lockOnInsert=false

有没有人尝试过使用 lockoninsert=false 在集群模式下运行 Quartz? 我打算使用以下配置

#============================================================================
# Configure Main Scheduler Properties  
#============================================================================

org.quartz.scheduler.instanceName = StandardScheduler
org.quartz.scheduler.instanceId = AUTO

#============================================================================
# Configure ThreadPool  
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 3
org.quartz.threadPool.threadPriority = 5

#============================================================================
# Configure JobStore  
#============================================================================

org.quartz.jobStore.misfireThreshold = 300000

org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
org.quartz.jobStore.lockOnInsert=false
org.quartz.jobStore.acquireTriggersWithinLock=true
org.quartz.jobStore.lockHandler.class=org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore

org.quartz.scheduler.jmx.export=true

最佳答案

A found some comment in the 1.8.6' source

    public boolean isLockOnInsert() {
            return lockOnInsert;
        }

        /**
         * Whether or not to obtain locks when inserting new jobs/triggers.  
         * Defaults to <code>true</code>, which is safest - some db's (such as 
         * MS SQLServer) seem to require this to avoid deadlocks under high load,
         * while others seem to do fine without.  
         * 
         * <p>Setting this property to <code>false</code> will provide a 
         * significant performance increase during the addition of new jobs 
         * and triggers.</p>
         * 
         * @param lockOnInsert
         */

关于java - 使用 lockoninsert=false 的集群模式下的 Quartz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45060599/

相关文章:

java - 如何在 Widget 上动态添加的元素上设置 LayoutParams

java - 这是 URL 的正确 xml 正则表达式吗?

java - Spring WEB 安全 : list of accessible URLs

grails - 从 quartz 作业内的config.groovy(conf目录中的)访问变量

java - 处理 Quartz 作业异常,以便它运行下一个正常轮次,而不会立即重新触发或丢弃

spring - 如何为持久性 Quartz 作业重命名作业类?

java - 如何比较两个程序的时间复杂度性能

java - 如何通过 Java 代码(而不是通过 JMS API - 生存时间)在 WebSphere MQ(队列)中设置消息过期时间

java - 如何使用 spring bean 执行方法

spring-mvc - 带有tomcat 8和spring mvc的Quartz调度程序创建多个线程并且在tomcat停止时无法停止