You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Locks in the JobScheduler stop the execution of a job, as long as a particular lock has been acquired by one or more jobs. Locks are available for individual jobs and for jobs in job chains. Should a job be waiting for a lock to be released (lock contention), then it will be automatically started as soon as the lock has been freed.

See also http://www.sos-berlin.com/doc/en/scheduler.doc/lock.xml

Example1: 3 Jobs using the same lock, one of them exclusive

First you have to create a lock then it can be acquired by jobs.
For example open the folder ./live/lockExample/ in JOE.
We create the lock "testLock"

and three jobs "job1", "job2", "job3" where "job1" use the "testLock" exclusive and the other non exclusive.

You can download this Example here.

We start the jobs in different orders to see what happens

  1. job1 -> job2 -> job3
    In this case job1 holds the lock exclusive and job2 and job3 don't start until job1 is finished and release the lock.
  2. job2 -> job3 -> job1
    In this case job2 and job3 start both because they hold the lock non exclusive. job1 wants to use the lock exclusive so it doesn't start until job2 and job3 are finish and release the lock.
  3. job2 -> job1 -> job3
    Same behaviour like case 2.

Example2: number of max nonexclusive jobs (useful for maintainance weekends)

We have the jobs "job1" and "job2" which have acquired a lock "maintain" nonexclusive.
Look above how you create the lock in JOE and how jobs acquire the lock nonexclusive.

Both jobs starts in the same manner like without the lock because they use it nonexclusive and the maximal number of nonexclusive jobs is unlimited.
Because of the lock is configured for unlimited nonexclusive use.

In this example a job chain is added with a job which change the maximal number of nonexclusive jobs.
The job chain has two orders. For one order the job set the maximal number of nonexclusive jobs equal 0.
For the other order the job set the maximal number of nonexclusive jobs unlimited (2^31-1).
If the maximal number of nonexclusive jobs equal 0 then no job which use this lock starts.

So you have one order to lock all jobs and another to release the jobs.
Has a job a schedule which tries to start the job while it is locked then this start goes into a task queue for later execution.
When the job is released then all starts from the task queue are executed.

  • No labels