+

Search Tips   |   Advanced Search

Develop enterprise beans for the timer service


In WAS, the EJB Timer Service implements EJBs Timers as a new kind of Scheduler Service task.

By default, an internal (or pre-configured) scheduler instance is used to manage those tasks, and they are persisted to a Apache Derby database associated with the server process.

However, we can perform some basic customization to the internal scheduler instance. For information about how to do this customization, see Set a timer service.

Creation and cancellation of Timer objects are transactional and persistent. That is, if a Timer object is created within a transaction and that transaction is later rolled back, the Timer object's creation is rolled back as well. Similar rules apply to the cancellation of a Timer object. Timer objects also survive across application server shutdowns and restarts.

 

  1. Write the enterprise bean to implement the javax.ejb.TimedObject interface, including the ejbTimeout() method. The bean calls the EJBContext.getTimerService() method to get an instance of the TimerServiceobject. The bean calls the TimerService method to create a Timer. This Timer is now associated with that bean.

  2. After you create it, we can pass the Timer instance to other Java code as a local object.

    For WAS V6, no assembly tooling supports the Enterprise Java Beans timedObject. To set the ejbTimeout method transaction attribute manually enter the attributes in the deployment descriptor. See EJB timer service settings for more information.


Clustered environment considerations for timer service

 

Related tasks


Set a timer service for network deployment

 

Related


Example: Using the Timer Service

 

Related information


EJB timer service settings