EJB Timer Service

From NovaOrdis Knowledge Base
Revision as of 15:25, 25 September 2017 by Ovidiu (talk | contribs) (Created page with "=Internal= * EJB Concepts =Overview= The EJB timer service is a container-provided service that invokes time-based callbacks into EJBs. The t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

Overview

The EJB timer service is a container-provided service that invokes time-based callbacks into EJBs. The time-based callbacks can be invoked according to a calendar-based schedule, at a specified time, after a specified elapsed time, or at specified intervals.

The timer service is a coarse-grained notification service that is not intended to model real-time events.

Timer service invocations can occur in a transactional context.

The timer service durations are expressed in milliseconds.

The timer service provides methods for programmatic creation and cancellation of timers, as well as for locating the timers that are associated with the bean. Timers can also be created automatically by the container at deployment based on the bean class or deployment descriptor metadata.


Timer

A timer is an object created to schedule a timed callback. The EJB class that uses the timer service must provide one or more timeout callbacks.



Initialization

An EJB may access the timer service via dependency injection, through the EJBContext interface or by looking it up in JNDI.

Dependency injection example:

<syntaxhighlight lang='java>

<syntaxhighlight lang='java>

API