Chapter 9. Timer Services

In this chapter, we will cover:

  • Setting up the ReportsApplication
  • Creating and using declarative timers
  • Creating and using programmatic timers
  • Understanding calendar-based scheduling
  • Using the timer interface
  • Using persistent and non-persistent timers
  • Creating timers upon application deployment
  • Using interceptors with timers


Many business functions are periodic in nature. For example, reports need to be generated, statistics need to be computed, and administrative cleanup tasks need to be performed; all on a regular basis. The EJB container's timer server supports time-delayed, asynchronous callbacks to an EJB to address these needs. An EJB will register with the timer service and a method will be called back.

Timers ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.