Table of Contents
EJB timer service is the service which enables you to receive timer callbacks periodically or at a specified time. Refer to EJB specification for basic usage of the timer service.
This chapter describes explanation and setting of the timer service in JEUS EJB.
In general, the JEUS EJB timer service follows the specification, but the function to manage the timer persistently can be used according to the desired performance and user's need.
The following settings can be configured for the timer service.
EJB Engine's Timer Service
Enables the shared properties and persistent timer service that are applied to all the beans using EJB timer service.
jeus-ejb-dd.xml
Configures how to manage Persistent Timers when deploying and updeploying each bean.
To set the persistent timer service of an EJB engine using the WebAdmin,
Click [Servers] on the left pane to go to the Server List page. Select a server from the list to go to the Server page. Select an EJB Engine to configure the Active Management setting. Click [Engine] > [EJB Engine] > [Timer Service].
Click [Lock & Edit] to change to edit mode.
Set the required Timer Service options and then click [OK].
The following is an example of configuring persistent timer service in Advanced Options.
Descriptions for each element are as follows:
The following table describes the necessary options for settings in Advanced Options.
Option | Description |
---|---|
Min | The minimum number of threads in the pool. |
Max | The maximum number of threads in the pool. |
Period | Indicates the time period to remove the threads in the pool which have been idle for the specified time value. |
The following table describes the mandatory option settings in Advanced Options.
Since the persistent timer internally uses CMP bean to access the Database, the CMP bean is configured through the following options. Therefore, each item in CMP bean is identical to the schema settings of a CMP bean.
Option | Description |
---|---|
DB Vendor | The Database vendor used by the Timer CMP bean. |
Data Source ID | The datasource resource name used by the Timer CMP bean. |
To dynamically apply the changes, click [Apply Changes].
When an EJB Engine is configured to use a persistent timer service, the user can decide whether to use Persistent timer service for each bean, use or discard the persistent timer that remains in the Database before deploying it, or perform other actions. This can be done through the jeus-ejb-dd.xml file.
Persistent Timer Service can be configured using the WebAdmin. For more information, refer to "10.1.1. Configuring the Persistent Timer Service (EJB Engine)".
The following is an example of jeus-ejb-dd.xml in which persistent timer processing is configured through the <durable-timer-service> element inside the <jeus-bean>.
[Example 10.1] Processing Persistent Timer: <<jeus-ejb-dd.xml>>
<jeus-ejb-dd> . . . <beanlist> . . . <jeus-bean> . . . <timer-service> <support-persistence> true </support-persistence> </timer-service> . . . </jeus-bean> . . . </beanlist> . . . </jeus-ejb-dd>
Details for each element are as follows:
All EJB engines must use the same EJB timer service. The timer service configured in each MS will be ignored.
To set a cluster-wide timer service using the WebAdmin,
Click [Clusters] on the left pane to go to the Cluster List page. Select a cluster from the list to go to the Cluster page.
Click [Lock & Edit] to change to edit mode.
Set the required Cluster Wide Timer Service options and then click [OK].
The description of each option is the same as the 'Database Setting' options in "10.1.1. Configuring the Persistent Timer Service (EJB Engine)".
To dynamically apply the changes, click [Apply Changes].
EJB timers can be monitored or cancelled using the WebAdmin or console tool.
To monitor or cancel an EJB timer using the WebAdmin,
Monitoring
Click [Monitoring] > [EJB Timers] on the left pane to go to the EJB Timers page. The list of running EJB timers will be displayed as follows:
Cancellation
An EJB Timer that runs on the server can be cancelled using the [cancel] button of a specific timer or in the 'command' column. The following screen shows how to cancel an EJB timer using the [cancel] button.
An EJB timer that runs on the server can be monitored or cancelled using the console tool.
For more information about the ejb-timer-info and cancel-ejb-timer commands or EJB engine related commands, refer to JEUS Reference Book. "4.2.7. EJB Engine Commands".
Persistent Timer is stored in the Database, and CMP Bean that manages the Timers uses the Time Service - Database Setting - Data Source Id value of the EJB engine. A transaction that includes beans which use the persistent timer also manages the datasource which is used by the Timer CMP bean. Therefore, you need to consider the datasource to determine whether to use LOCALXAResource or XAResource.
For more information about data sources, refer to "JEUS Server Guide".