Developing Enterprise bean (EJB) persistent timer applications

EJB persistent timers are created either automatically by the container or programmatically by an application. Both types of persistent timers are stored in tables in the database that is configured for the EJB timer service in the server.xmlfile.

About this task

After the persistent timer is created, it exists in the database until one of the following occurs:

  • The timer is not scheduled for further expirations; for example, after a single-action timer expires and runs successfully.
  • The timer is canceled by the application.
  • The timer is canceled by using the EJB timer service MBean (EJBPersistentTimerServiceMXBean)
  • The timer is manually removed from the database. For example, if the timer service database is cleared or removed.

Also, note that EJB persistent timers are associated with an EJB based on the application name, module name, and bean name. If an application is updated, and any of these names change, then the timer continues to exist in the database, but appears to no longer exist as it no longer expires and runs.

The Enterprise JavaBeans specification declares that automatic timers are created by the container when an application is deployed. For the Liberty, this occurs the first time that an application starts within a server process. During the first application start, the automatically created persistent timers are stored in the persistent timer database along with an indication that the application has been deployed. The container does not create the automatic persistent timers again until both the timers and the indication that the application has been deployed is removed from the EJB persistent timer database.

Procedure

Enable the EJB persistent timer feature in the server.xml file; for example:
<featureManager>
     <feature>ejbPersistentTimer-3.2</feature>
</featureManager>

Icon that indicates the type of topic Task topic



Timestamp icon Last updated: Saturday, 3 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twlp_ejb_perstimer
File name: twlp_ejb_perstimer.html