Sun GlassFish Enterprise Server v3 Prelude Developer's Guide

EJB Timer Service

The EJB Timer Service uses a database to store persistent information about EJB timers.

The EJB Timer Service in Enterprise Server is preconfigured to use an embedded version of the Java DB database.

Note –

If the optional JTS add-on component has not been downloaded from the Update Tool, you must reconfigure the JDBC resource named jdbc/__TimerPool. If the optional JTS add-on component has been downloaded, this is not necessary. For information about the Update Tool, see the Sun GlassFish Enterprise Server v3 Prelude Installation Guide.

In the Administration Console, open the Resources component and select JDBC Resources. For details, click the Help button in the Administration Console. Change the connection pool name for the JDBC resource named jdbc/__TimerPool to point to the same connection pool as the one you are using for the rest of your data. Then start the database.

To enable the timer service, deploy the following application:


You can verify that it was deployed successfully by accessing the following URL:


The EJB Timer Service configuration can store persistent timer information in any database supported by the Enterprise Server for persistence. For a list of the JDBC drivers currently supported by the Enterprise Server, see the Sun GlassFish Enterprise Server v3 Prelude Release Notes. For configurations of supported and other drivers, see Configuration Specifics for JDBC Drivers in Sun GlassFish Enterprise Server v3 Prelude Administration Guide.

To change the database used by the EJB Timer Service, set the EJB Timer Service’s Timer DataSource setting to a valid JDBC resource. You must also create the timer database table. DDL files are located in as-install/lib/install/databases.

Using the EJB Timer Service is equivalent to interacting with a single JDBC resource manager. If an EJB component or application accesses a database either directly through JDBC or indirectly (for example, through an entity bean’s persistence mechanism), and also interacts with the EJB Timer Service, its data source must be configured with an XA JDBC driver.

You can change the following EJB Timer Service settings. You must restart the server for the changes to take effect.