Table of Contents
This chapter describes how to configure JEUS Scheduler in a JEUS configuration file or Deployment Descriptor(DD).
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.
This section describes how to register jobs.
A job can be registered programmatically 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.
Item | Description |
---|---|
Begin Time | Initial time to execute the task. If not set, the task executes when JEUS server starts.
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.
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. |
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.
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.
Click [Servers] on the left menu to show the list of servers. Click a server (server1) to change its scheduler configuration from the list.
On the Servers screen, select [Resource] > [Scheduler] to go to the Scheduler configuration page.
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.
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.
To add a job, click [Add] in the Job list.
On the Job configuration page, enter the class name and job execution cycle, and click [OK].
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.
Click [Apply Changes] to apply the changes to the scheduler.
Scheduler configuration chages are not applied dynamically. The changes take effect after the server restarts.
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
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.
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".
If the Scheduler Service uses a shared thread pool, only the number of threads needs to be configured.
This section describes how to set the thread pool using WebAdmin. Before setting the thread pool, the lock setting must be changed.
On the Scheduler page, the thread pool configuration can be changed in Advanced Options.
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.
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.
The thread pool configuration is applied dynamically to the server while it is running.
The following shows how to set the thread pool of the scheduler using the console tool jeusadmin.
[Example 3.1] Shared Thread Pool Configuration in 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 appli ed 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 Show the current configuration. The sheduler thread pool of the server (server1). ================================================================================ +---------------------------------------------------------------------+--------+ | Reserved Threads for the Service scheduler | 10 | +---------------------------------------------------------------------+--------+ ================================================================================
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.
The following describes how to set the thread pool using WebAdmin. The lock should be set before configuring the thread pool.
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.
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".
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.
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.
The thread pool configuration is applied dynamically to the server while it is running.
The following shows how to configure the scheduler's thread pool using the console tool (jeusadmin).
[Example 3.2] Configuring the Shared Thread Pool of the Scheduler Service via 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 appli ed 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 | | Stuck Thread Action | NONE | +--------------------------------------------------------+---------+ ====================================================================
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.
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.3] 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.
The shared thread pool cannot be used when using Scheduler Service on a client container.
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.4] 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>