Description
Throttle parallel execution. This will limit the
number of jobs running in parallel.
Example
Throttling parallel execution.
<oddjob>
<job>
<parallel id="parallel">
<executorService>
<throttle limit="2"/>
</executorService>
<jobs>
<wait name="Wait 1"/>
<wait name="Wait 2"/>
<wait name="Wait 3"/>
<wait name="Wait 4"/>
</jobs>
</parallel>
</job>
</oddjob>
Example
Sharing a throttle. The same throttle is shared between
to ParallelJob
jobs. The total number of jobs executing between
both parallels is 2.
<oddjob>
<job>
<sequential>
<jobs>
<variables id="vars">
<throttle>
<convert>
<value>
<throttle limit="2"/>
</value>
</convert>
</throttle>
</variables>
<parallel id="parallel-1">
<executorService>
<value value="${vars.throttle.is}"/>
</executorService>
<jobs>
<wait name="Wait 1"/>
<wait name="Wait 2"/>
</jobs>
</parallel>
<parallel id="parallel-2">
<executorService>
<value value="${vars.throttle.is}"/>
</executorService>
<jobs>
<wait name="Wait 3"/>
<wait name="Wait 4"/>
</jobs>
</parallel>
</jobs>
</sequential>
</job>
</oddjob>
The throttle type is a factory type and so would provide a new instance
each time it's used. To overcome this the throttle is
wrapped in a convert ConvertType
that creates a single instance.
- Author:
- rob