有人知道如何使 EJBTimers 不在文件系统中持久化,而是在选定的数据库表中持久化吗? 例如,在 JBoss 4.x.x 中借助 ejb-deployer.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server>
...
<mbean code="org.jboss.ejb.txtimer.EJBTimerServiceImpl"
name="jboss.ejb:service=EJBTimerService">
<attribute name="RetryPolicy">jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay</attribute>
<attribute name="PersistencePolicy">jboss.ejb:service=EJBTimerService,persistencePolicy=database</attribute>
<attribute name="TimerIdGeneratorClassName">org.jboss.ejb.txtimer.BigIntegerTimerIdGenerator</attribute>
<attribute name="TimedObjectInvokerClassName">org.jboss.ejb.txtimer.TimedObjectInvokerImpl</attribute>
<depends optional-attribute-name="TransactionManagerFactory" proxy-type="org.jboss.tm.TransactionManagerFactory">
jboss:service=TransactionManager
</depends>
</mbean>
<!-- A retry policy that uses a fixed interval in milli seconds -->
<mbean code="org.jboss.ejb.txtimer.FixedDelayRetryPolicy" name="jboss.ejb:service=EJBTimerService,retryPolicy=fixedDelay">
<attribute name="Delay">100</attribute>
</mbean>
<mbean code="org.jboss.ejb.txtimer.DatabasePersistencePolicy" name="jboss.ejb:service=EJBTimerService,persistencePolicy=database">
<!-- DataSourceBinding ObjectName -->
<depends optional-attribute-name="DataSource">jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
<!-- The plugin that handles database persistence -->
<attribute name="DatabasePersistencePlugin">org.jboss.ejb.txtimer.GeneralPurposeDatabasePersistencePlugin</attribute>
<!-- The timers table name -->
<attribute name="TimersTable">TIMERS</attribute>
</mbean>
</server>
我没有找到如何替换这个:
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
</timer-service>
强制将计时器保留在数据库中。
提前致谢!
最佳答案
目前,持久性 EJBTimers 仅存储到文件系统中。对应issue已经存在。不幸的是,它仅针对 EAP 系统...看看 Cron Module of Seam 3 。该模块与 Quartz 配合使用,Quartz 提供 JDBC 存储的计时器。
关于jboss7.x - JBoss 7.1 : Persistent EjbTimer - how to?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9979179/