Chapter 10. EJB Timer Service

Table of Contents

10.1. Configuring the Timer Service
10.1.1. Configuring the Persistent Timer Service (EJB Engine)
10.1.2. Processing the Persistent Timer (jeus-ejb-dd.xml)
10.1.3. Configuring the Cluster-Wide Timer Service
10.2. Configuring Timer Monitoring
10.3. Warnings for Timer Service
10.3.1. Persistent Timer and JDBC Connection

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.

10.1. Configuring the Timer Service

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.

10.1.1. Configuring the Persistent Timer Service (EJB Engine)

To set the persistent timer service of an EJB engine using the WebAdmin,

  1. 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].

  2. Click [Lock & Edit] to change to edit mode.

  3. Set the required Timer Service options and then click [OK].

    [Figure 10.1] Configuring Persistent Timer Service - Basic Options

    Configuring Persistent Timer Service - Basic Options

    The following is an example of configuring persistent timer service in Advanced Options.

    [Figure 10.2] Persistent Timer Service - Advanced Options

    Persistent Timer Service - Advanced Options

    Descriptions for each element are as follows:

    • Thread Pool

      The following table describes the necessary options for settings in Advanced Options.

      OptionDescription
      MinMinimum number of threads in the pool.
      MaxMaximum number of threads in the pool.
      PeriodTime period for which idle threads can remain in the pool before removal.
    • Database Setting

      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.

      OptionDescription
      DB VendorDatabase vendor used by the Timer CMP bean.
      Data Source IDDataSource name used by the Timer CMP bean.

  4. To dynamically apply the changes, click [Apply Changes].

10.1.2. Processing the Persistent Timer (jeus-ejb-dd.xml)

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.

Note

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>


The following describes the Timer element:

ElementDescription
<support-persistence>Determines whether to manage the timer of the bean persistently.

10.1.3. Configuring the Cluster-Wide Timer Service

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,

  1. 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.

  2. Click [Lock & Edit] to change to edit mode.

  3. Set the required Cluster Wide Timer Service options and then click [OK].

    [Figure 10.3] Configuring Cluster-Wide Timer Service

    Configuring Cluster-Wide Timer Service

    The description of each option is the same as the 'Database Setting' options in "10.1.1. Configuring the Persistent Timer Service (EJB Engine)".

  4. To dynamically apply the changes, click [Apply Changes].

10.2. Configuring Timer Monitoring

EJB timers can be monitored or cancelled using the WebAdmin or console tool.

Using WebAdmin

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:

    [Figure 10.4] Timer Monitoring

    Timer Monitoring

  • 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.

    [Figure 10.5] Cancelling the Timer

    Cancelling the Timer

Using Console Tool

An EJB timer that runs on the server can be monitored or cancelled using the console tool.

  • Monitoring

    Information about an EJB timer is displayed using the ejb-timer-info command.

    ejb-timer-info -server <server-name>

  • Cancellation

    An EJB timer is cancelled using the cancel-ejb-timer command.

    cancel-ejb-timer -server <server-name>

Note

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".

10.3. Warnings for Timer Service

10.3.1. Persistent Timer and JDBC Connection

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.

Note

For more information about data sources, refer to "JEUS Server Guide".