This job is probably most useful in it's 'not equals' form - i.e. to check when something hasn't completed.
job | The job to run who's state will be compared. |
name | A name, can be any text. |
state | The state to match. |
stop | Read only view of the internal stop flag. |
Example 1 | COMPLETE when the child job isn't complete. |
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | Yes. |
The job to run who's state will be compared.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
A name, can be any text.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No, defaults to COMPLETE. |
The state to match.
Access | READ_ONLY |
Read only view of the internal stop flag. This flag is cleared with a reset.
COMPLETE when the child job isn't complete. This example
demonstrates how the state:equals
job can be used to reverse
the meaning of the exists
job. A request to
shutdown a database may complete asynchronously, and the only
way to tell if shutdown is complete is to check that the Database's
lock file has be removed. This example demonstrates how Oddjob
can check for this situation
before attempting to back up the database.
<oddjob id="this"> <job> <scheduling:retry name="Database Backup" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling"> <schedule> <schedules:interval interval="00:00:02" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/> </schedule> <job> <sequential id="db-backup"> <jobs> <state:equals state="!COMPLETE" xmlns:state="http://rgordon.co.uk/oddjob/state"> <job> <state:resets harden="true"> <job> <exists file="${db.lock.file}"/> </job> </state:resets> </job> </state:equals> <echo>Backing up the Database...</echo> </jobs> </sequential> </job> </scheduling:retry> </job> </oddjob>