+

Search Tips   |   Advanced Search

 

Develop Enterprise JavaBeans 2.1 for the timer service

 

 

Overview

In WAS, the EJB Timer Service implements EJB 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 Cloudscape database associated with the server process.

However, you can perform some basic customization to the internal scheduler instance. For information about how to do this customization, see Configure 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 appserver shutdowns and restarts.

 

Procedure

  1. Write your 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 creating it, you can pass the Timer instance to other Java code as a local object.

    For WebSphere Application Server V6, no assembly tooling supports the Enterprise JavaBeans 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


Configure a Timer Service for network deployment

 

Related Reference


Example: Using the Timer Service

 

Related information


EJB Timer Service settings