[Index]

repeat


This job will repeatedly run its child job. The repeat can be either for:

Without either a until or a times or values the job will loop indefinitely.


Property Summary

count The count of repeats.
current The current value of the repeat.
executorService The ExecutorService to use.
index The same as count.
job The job who's execution to schedule.
name A name, can be any text.
stop Read only view of the internal stop flag.
times The number of times to repeat.
until Repeat will repeat until the value of this property is true.
values Values to repeat over.

Example Summary

Example 1 Repeat a job 3 times.
Example 2 Repeat a job 3 times with a sequence.

Property Detail

count

AccessREAD_ONLY
RequiredRead Only.

The count of repeats.

current

AccessREAD_ONLY
RequiredRead Only.

The current value of the repeat.

executorService

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

The ExecutorService to use. This will be automatically set by Oddjob.

index

AccessREAD_ONLY

The same as count. Provided so configurations can be swapped between this and foreach job.

job

Configured ByELEMENT
AccessWRITE_ONLY
RequiredYes.

The job who's execution to schedule.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

A name, can be any text.

stop

AccessREAD_ONLY

Read only view of the internal stop flag. This flag is cleared with a reset.

times

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The number of times to repeat.

until

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

Repeat will repeat until the value of this property is true.

values

Configured ByELEMENT
AccessREAD_WRITE
RequiredNo.

Values to repeat over.


Examples

Example 1

Repeat a job 3 times.

<oddjob>
    <job>
        <repeat times="3" id="repeat">
            <job>
                <echo>Hello ${repeat.count}</echo>
            </job>
        </repeat>
    </job>
</oddjob>

Example 2

Repeat a job 3 times with a sequence.

<oddjob>
    <job>
        <repeat id="each">
            <values>
                <sequence from="1" to="3"/>
            </values>
            <job>
                <echo>Hello ${each.current}</echo>
            </job>
        </repeat>
    </job>
</oddjob>


(c) R Gordon Ltd 2005 - Present