The EJB Timer service

Stateless session beans and message-driven beans (another type of EJB discussed later in the book) can have a method that is executed automatically at regular intervals. This functionality is useful if we want to execute some logic periodically (once a week, every day, every other hour, and so on) without having to explicitly call any methods. This functionality is achieved by the EJB Timer service.

In order to use the EJB Timer service, we need to use the @Schedule annotation to specify when our method will be called. NetBeans provides a handy wizard that we can use to help us in the process.

The EJB Timer service

The next step in the wizard allows ...

Get Java EE 7 Development with NetBeans 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.