Grails Quartz 插件在启用持久性的情况下在启动时删除触发器
我遇到了以下问题:我有一个带有quartz 插件的grails 应用程序和一个持久存储(Oracle)。我的作业类有一个空的触发器块,如下所示:
class VodServerJob {
static triggers = {}
def volatility = false;
def durability = true;
def concurrency = false;
def group = "MyGroup"
def execute(context) { }
}
...但我在进行过程中以编程方式添加触发器(让用户安排作业的启动时间)。当我关闭应用程序时,触发器仍在数据库中。但在启动时,触发器被删除,从而破坏了持久存储的意义。
我的配置如下:
quartz {
autoStartup = true
jdbcStore = true
waitForJobsToCompleteOnShutdown = true
}
environments {
test { quartz { autoStartup = false } }
}
我的属性如下:
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@172.27.5.18:1521:dcrm
org.quartz.dataSource.myDS.user = <hidden, but valid>
org.quartz.dataSource.myDS.password = <hidden, but valid>
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual
根据我所看到的一切,这应该允许数据库持久性,但是,它在启动时被删除。有人知道为什么吗?
I'm encountering the following problem: I've got a grails app, with the quartz plugin, and a persistent storage (Oracle). My job class has an empty triggers block like so:
class VodServerJob {
static triggers = {}
def volatility = false;
def durability = true;
def concurrency = false;
def group = "MyGroup"
def execute(context) { }
}
...but I programatically add the triggers as I go along (letting the user schedule kick-off times for a job). When I shut down the app, the triggers are still in the database. But on startup, the triggers are removed, defeating the point of persistent storage.
My config is as follows:
quartz {
autoStartup = true
jdbcStore = true
waitForJobsToCompleteOnShutdown = true
}
environments {
test { quartz { autoStartup = false } }
}
and my properties are as follows:
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@172.27.5.18:1521:dcrm
org.quartz.dataSource.myDS.user = <hidden, but valid>
org.quartz.dataSource.myDS.password = <hidden, but valid>
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual
According to everything I can see, this should allow for DB persistence, and yet, it's getting removed on startup. Anyone have any ideas as to why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了这个问题的答案。默认情况下,触发器设置为
易失性
,这意味着它们在启动时被删除。只需按如下方式将触发器的volatility
设置为false
即可无限期地保留触发器。trigger.setVolatility(false);
否则,它们将被擦除。
Found the answer on this one. Triggers are set to
volatile
by default, which means they are deleted on startup. Just setvolatility
of the trigger tofalse
as follows for your triggers to be indefinitely persisted.trigger.setVolatility(false);
Otherwise, they'll get wiped.