Chapter 3. Scheduler Configuration

Table of Contents

3.1. Overview
3.2. Configuring Job-list
3.3. Configuring Server Scheduler
3.4. Configuring Thread Pool
3.4.1. Shared Thread Pool
3.4.2. Dedicated Thread Pool
3.5. Configuring Client Container

This chapter describes how to configure JEUS Scheduler in a JEUS configuration file or Deployment Descriptor (DD).

3.1. Overview

The following configuration is required to use a JEUS Scheduler service.

  • Configuring Scheduler Services on JEUS server

    When accessing JEUS server Scheduler Service from a remote server, the Scheduler Service must be activated on the server that executes jobs through Job-list. To active the Scheduler Service, the Scheduler Service configuration must be set to start the Scheduler Service when server boots.

    • Configure to use the Scheduler Service.

    • Configure the thread pool for the Scheduler Service.

    • Configure Job-list scheduled to execute on the server.

  • Configuring Scheduler Service on the client container

    • Configure in Deployment Descriptor (DD).

To use the scheduler, scheduler service must be activated and the thread pool and Job-list must be configured.

3.2. Configuring Job-list

This section describes how to register jobs.

A job can be registered or be configured to be scheduled at JEUS server startup in the JEUS configuration file. A job is a single task unit that is scheduled. A job class must implement the jeus.schedule.ScheduleListener interface, and the class and its related classes must be compressed into a jar file and saved in the following location.

  • Since the following directory is not synchronized between Domain Administration Server (hereafter DAS) and Managed Server (hereafter MS), the user must synchronize them manually.

    DOMAIN_HOME/lib/application
  • The following directory must be created manually in the following path by the user.

    SERVER_HOME/lib/application

JEUS Scheduler Service executes jobs that are configured on the server.

The following items must be configured with care.

ItemDescription
Begin Time

Initial time to execute the task. If not set, the task executes when JEUS server starts.

  • Type: XML dateTime type

  • Format: yyyy-mm-ddThh:mm:ss.sss

If the Begin Time of a registered job has already passed, the initial execution time is adjusted to a time after the current time.

End Time

Time when the task terminates. If not set, the task does not terminate.

  • Type: XML dateTime type

  • Format: yyyy-mm-ddThh:mm:ss.sss

If End Time has already passed, the task does not execute at all.

Count

Maximum number of executions.

If Count is not set or set to -1, there is no limit for the number of executions.

Note

If a task is registered in the Job-list, the task executes at a fixed-rate in relative time. If a task execution is delayed, same tasks may be executed concurrently and task objects should be checked for thread-safety.

3.3. Configuring Server Scheduler

This section describes how to configure the scheduler on the server using WebAdmin.

To access the JEUS server Scheduler Service or to execute a recurring task on JEUS server using Job-list, the Scheduler Service must be activated in WebAdmin. To activate the Service, it must be configured for use in WebAdmin, and then the server starts the Scheduler Service when the server boots.

The following are the steps for adding the job from "2.3.2. Schedule Class Inheritance" to the server.

  1. Click [Servers] on the left menu to show the list of servers. Click a server (server1) to change its scheduler configuration from the list.

    [Figure 3.1] WebAdmin Server List

    WebAdmin Server List


  2. On the Servers screen, select [Resource] > [Scheduler] to go to the Schedulerconfiguration page.

    [Figure 3.2] WebAdmin Scheduler Configuration Page

    WebAdmin Scheduler Configuration Page

  3. Click [Lock & Edit] under the left menu to get the lock to change the scheduler configurations. For more information about the lock configuration, refer to JEUS WebAdmin Guide. "2.4.4. Locking the Configuration".

    The scheduler configuration can be changed after getting the lock.

    [Figure 3.3] WebAdmin Scheduler Configuration - Lock Configuration

    WebAdmin Scheduler Configuration - Lock Configuration


  4. Check 'Enabled' and set the thread pool information in the advanced options that are used in the scheduler. For more information about the scheduler's thread pool, refer to "3.4. Configuring Thread Pool".

    After completing the configuration, click [OK]. If saved successfully, the result message is displayed at the top of the page. Skip this step If 'Enabled' is checked.

    [Figure 3.4] WebAdmin Scheduler Configurations - Scheduler Configuration

    WebAdmin Scheduler Configurations - Scheduler Configuration

  5. To add a job, click [Add] in the Job list.

    [Figure 3.5] WebAdmin Scheduler Configuration - Adding a Job

    WebAdmin Scheduler Configuration - Adding a Job


  6. On the Jobconfiguration page, enter the class name and job execution cycle, and click [OK].

    [Figure 3.6] WebAdmin Scheduler Configuration - Saving a Job

    WebAdmin Scheduler Configuration - Saving a Job


  7. The following is the result of temporarily saving the changes by clicking [OK]. The result message is displayed at the top of the page and the added job appears in the Job list.

    [Figure 3.7] WebAdmin Scheduler Configuration - Checking the Newly Added Job

    WebAdmin Scheduler Configuration - Checking the Newly Added Job

  8. Click [Apply Changes] to apply the changes to the scheduler.

    Note

    Scheduler configuration changes are not applied dynamically. The changes take effect after the server restarts.

    [Figure 3.8] WebAdmin Scheduler Configuration - Applying the Added Job

    WebAdmin Scheduler Configuration - Applying the Added Job

  9. When the server restarts, the newly created job executes and the result can be checked in the server logs.

    ##### waked on Tue Apr 23 14:50:19 KST 2013
    ##### waked on Tue Apr 01 15:20:19 KST 2013

3.4. Configuring Thread Pool

This section describes how to set a thread pool using WebAdmin and the console tool. For more information, refer to JEUS Server Guide. "2.3.3. Thread Pool Configuration".

Scheduler Service adjusts the thread pool to the required number of threads for service execution. The thread pool is divided into the System Thread Pool and Dedicated Thread Pool.

3.4.1. Shared Thread Pool

If the Scheduler Service uses a shared thread pool, only the number of threads needs to be configured.

Using WebAdmin

This section describes how to set the thread pool using WebAdmin. Before setting the thread pool, the lock setting must be changed.

  1. Click [Servers] on the left menu to view the list of servers ([Figure 3.1]).

    Click a server (server1) from the list to go to the server configuration page. On the screen, click [Resource] > [Schedule] to go to the Scheduler screen ([Figure 3.2]).

  2. Click [Lock & Edit] to change to configuration mode. Set the thread pool configuration in the Advanced Options. For more information about Lock configuration mode, refer to JEUS WebAdmin Guide. "2.4.4. Locking the Configuration".

  3. On the Advanced Options page under Pooling select 'Shared' and set the number of 'Reserved Thread Num' to 10. Click [OK] to temporarily save the modified configuration and the result is displayed at the top of the page.

    [Figure 3.9] Thread Pool Configurations - Shared Thread Pool Configuration (1)

    Thread Pool Configurations - Shared Thread Pool Configuration (1)

  4. Click [Apply Changes]. Once activated, the thread pool configuration of the scheduler is applied on the server and the result is displayed at the top of the page.

    [Figure 3.10] Thread Pool Configurations - Shared Thread Pool Configuration (2)

    Thread Pool Configurations - Shared Thread Pool Configuration (2)

Using the Console Tool

The following shows how to set the thread pool of the scheduler using the console tool jeusadmin.

[DAS]domain1.adminServer>modify-system-thread-pool server1 -service scheduler -r 10
Successfully performed the MODIFY operation for The scheduler thread pool of the server (server1)., 
but all changes were non-dynamic. They will be applied after restarting.
Check the results using "show-system-thread-pool server1 -service scheduler or modify-system-thread-pool server1 -service scheduler".

[DAS]domain1.adminServer>show-system-thread-pool server1 -service scheduler
Shows the current configuration.
the system thread pool of the server (server1)
================================================================================
+---------------------------------------------------------+--------------------+
| Min                                                     | 0                  |
| Max                                                     | 100                |
| Keep-Alive Time                                         | 300000             |
| Queue Size                                              | 4096               |
| Max Stuck Thread Time                                   | 3600000            |
| Action On Stuck Thread                                  | IGNORE_AND_REPLACE |
| Stuck Thread Check Period                               | 300000             |
| Reserved Threads for the Service transaction            | 0                  |
| Reserved Threads for the Service scheduler              | 10                 |
| Reserved Threads for the Service namingserver           | 0                  |
+---------------------------------------------------------+--------------------+
================================================================================

3.4.2. Dedicated Thread Pool

If the Scheduler Service uses the dedicated thread pool, the thread pool can be configured using WebAdmin or the console tool (jeusadmin). This section describes how to configure the dedicated thread pool using WebAdmin and the console tool.

Using WebAdmin

The following describes how to set the thread pool using WebAdmin. The lock should be set before configuring the thread pool.

  1. Click [Servers] on the left menu to view the list of servers ([Figure 3.1]).

    Click a server (server1) from the list to go to the server configuration page. On the screen, click [Resource] > [Schedule] to go to the Scheduler screen ([Figure 3.2]).

  2. Click [Lock & Edit] to change to configuration mode. Set the thread pool configuration in the Advanced Options. For more information about Lock configuration mode, refer to JEUS WebAdmin Guide. "2.4.4. Locking the Configuration".

  3. Check 'Pooling' in Advanced Options and select 'Dedicated'. Set 'Min' to 0 and 'Max' to 20, and then click [OK]. Click [OK] to temporarily save the modified configuration and the result is displayed in at the top of the page.

    [Figure 3.11] Dedicated Thread Pool Configuration (1)

    Dedicated Thread Pool Configuration (1)

  4. Click [Apply Changes] to apply the changes to the server. Once the thread pool configuration changes are applied, the result is displayed at the top. Since the thread pool configuration is not applied dynamically to the server, the server must restart. However, the number of pools can be dynamically changed.

    [Figure 3.12] Dedicated Thread Pool Configuration (2)

    Dedicated Thread Pool Configuration (2)

Using the Console Tool

The following shows how to configure the scheduler's thread pool using the console tool (jeusadmin).

[DAS]domain1.adminServer>show-service-thread-pool server1 -service scheduler
Shows the current configuration.
==================================================
+------+-----------------------------------------+
(No data available)
==================================================

[DAS]domain1.adminServer>modify-service-thread-pool server1 -service scheduler -min 0 -max 20
Successfully performed the MODIFY operation for The scheduler thread pool of the server (server1)., 
but all changes were non-dynamic. They will be applied after restarting.
Check the results using "show-service-thread-pool server1 -service scheduler or modify-service-thread-pool server1 -service scheduler".

[DAS]domain1.adminServer>show-service-thread-pool server1 -service scheduler
Shows the current configuration.
=====================================================================
+---------------------------------------------------------+---------+
| Min                                                     | 0       |
| Max                                                     | 20      |
| Keep-Alive Time                                         | 60000   |
| Queue Size                                              | 4096    |
| Max Stuck Thread Time                                   | 3600000 |
| Action On Stuck Thread                                  | NONE    |
| Stuck Thread Check Period                               | 300000  |
+---------------------------------------------------------+---------+
=====================================================================

Note

The thread pool configuration of the Scheduler Service is dynamic and therefore the server does not need to be restarted. However, the server must be restarted when changing from using the shared thread pool to the dedicated thread pool for changes to take effect.

3.5. Configuring Client Container

This section describes how to configure the JEUS Scheduler that is running on a client container when using a Java EE application. Add the following <scheduler> element to the JEUS DD file, jeus-client-dd.xml.

[Example 3.1] Client Container Configuration - <<jeus-client-dd.xml>>

<?xml version="1.0"?>
<jeus-client-dd>
    <module-info>
        ...
    </module-info>
    ...
    <scheduler>
        <enabled>true</enabled>      
        <!-- Scheduler Thread-pool settings -->
        <pooling>
            <dedicated>
                <min>2</max>
                <max>10</max>
                <keep-alive-time>60000</keep-alive-time>
                <queue-size>4096</queue-size>
                <stuck-thread-handler>
                    <max-stuck-thread-time>3600000</max-stuck-thread-time>
                    <action-on-stuck-thread>None</action-on-stuck-thread>
                </stuck-thread-handler>
            </dedicated>
        </pooling>     
    </scheduler>
  ...
</jeus-client-dd>


To apply the changes after modifying the previous configuration file, the JEUS server does not need to be restarted, but client modules and client containers must be restarted.

Caution

1. The shared thread pool cannot be used when using Scheduler Service on a client container.

2. For more information about client containers and application clients, refer to "JEUS Application Client Guide".

The following shows how to set jobs that run on client containers.

[Example 3.2] Job-list Configuration - <<jeus-client-dd.xml>>

<scheduler>
    ...
    <job-list>
        <job>
            <class-name>samples.ScheduleJob</class-name>
            <name>ScheduleJob</name>
            <description>This is a sample for scheduler service</description>
            <begin-time>2011-02-01T00:00:00</begin-time>
            <end-time>2011-03-01T00:00:00</end-time>
            <interval>
                <minutely>30</minutely>
            </interval>
            <count>-1</count>
        </job>
    </job-list>
</scheduler>