Skip Headers
Oracle® Application Server Containers for J2EE Job Scheduler Developer's Guide
10g Release 3 (10.1.3)
B15876-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

5 Pausing Jobs

This chapter describes what it means to pause a job and how to pause a job. The following topics are covered:

5.1 What Does It Mean to Pause a Job?

Pausing a job causes a scheduled job execution to be skipped. It does not stop a job execution that is currently running (to do this, you must cancel the job). Pausing a job does not remove the job's definition from the system, thus preventing the job from running in the future (to do this, you must remove the job). Use the oracle.ias.scheduler.Scheduler.pause() method to pause a job.

For more information about canceling jobs, see Chapter 6. For more information about removing jobs, see Chapter 2.

For more information about the pause() method, see Oracle Containers for J2EE Job Scheduler API Reference.

A job execution that was skipped because it was paused can be run again by resuming the job with the replay parameter set to true. Use the oracle.ias.scheduler.Scheduler.resume() method to resume a job.

To illustrate more clearly the effect of pausing and resuming a job, consider the following timeline in Figure 5-1.

Figure 5-1 Pausing and Resuming a Job with a Single-Action Schedule

Pause and Resume on a Job with a Single-Action Schedule
Description of "Figure 5-1 Pausing and Resuming a Job with a Single-Action Schedule"

There is a pause implemented for a particular job at around 10:30 p.m., and it is scheduled to resume at 2:00 a.m. However, this job is scheduled to run at 12:00 a.m. Will this job run?

Due to the pause at 10:30 p.m., the job execution scheduled to run at midnight will be skipped. However, if the job is resumed at 2:00 a.m. with replay set to true, then the job execution scheduled to run at midnight will run at 2:00 a.m. If replay is set to false, then the job execution scheduled to run at midnight will not run.

In contrast, consider Figure 5-2, which illustrates the effect of pausing and resuming on a job with a repeating schedule.

Figure 5-2 Pausing and Resuming a Job with a Repeating Schedule

Pause and Resume on a Job with a Repeating Schedule
Description of "Figure 5-2 Pausing and Resuming a Job with a Repeating Schedule"

In this scenario, there is a job with a repeating schedule (multiple job executions scheduled) that falls between pause and resume. If the job is resumed at 2:00 a.m. with replay set to true, then only the first job execution (the one at 11:00 p.m.) will run. The job executions at midnight and 1:00 a.m. will be skipped.

5.2 How to Pause a Job

This section shows some code examples of how to pause and resume a job.

Example 5-1 Pausing a Job

This example shows how to use the oracle.ias.scheduler.Scheduler.pause() method to pause the job called BackupJob.

//pause the "BackupJob" job
scheduler.pause(jobHandle)

Example 5-2 Resuming a Job Without Replay

This example shows how to set replay to false, so that a job execution that was skipped will not be run again.

//resume the "BackupJob" job without replay
scheduler.resume(jobHandle, FALSE)

Example 5-3 Resuming a Job with Replay

This example shows how to set replay to true, so that a job execution that was skipped will be run again.

//resume the "BackupJob" job with replay
scheduler.resume(jobHandle, TRUE)

5.3 Frequently Asked Questions About Pausing Jobs

What happens if you pause a job that is currently running?

Pausing a job that is currently running does not interrupt the job. However, pausing a job prevents the job from running in the future until it is resumed.

At execution time, what is the difference between a blackout window and a paused job?

A blackout window suppresses all job executions while a paused job suppresses only job executions that result from a trigger being fired. For example, pausing a job would not suppress replayed or retried job executions, but running a job in a blackout window would.

What happens if retry is attempted when a job is paused?

A paused job suppresses any job executions that occur due to a trigger expression evaluating to true. During a retry, the trigger expression is never evaluated and the job is allowed to run.