Developing Enterprise JavaBeans 2.1 for the timer service

 

About this task

In WebSphere Application Server, 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, we can perform some basic customization to the internal scheduler instance. For information about how to do this customization, see Configuring 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.

 

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

    Note: 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.

 

See also


Clustered environment considerations for timer service
Related tasks
Configuring a Timer Service for network deployment Related reference
Example: Using the Timer Service


Related information


EJB Timer Service settings