public class ExecutorThrottleType extends java.lang.Object implements ValueFactory<java.util.concurrent.ExecutorService>
<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>
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.
ValueFactory.Conversions| Constructor and Description |
|---|
ExecutorThrottleType() |
| Modifier and Type | Method and Description |
|---|---|
int |
getLimit() |
java.util.concurrent.ExecutorService |
getOriginal() |
void |
setLimit(int max) |
void |
setOriginal(java.util.concurrent.ExecutorService original) |
java.lang.String |
toString() |
java.util.concurrent.ExecutorService |
toValue()
Provide an instance of the type this is a factory for.
|
public java.util.concurrent.ExecutorService toValue()
throws ArooaConversionException
ValueFactorytoValue in interface ValueFactory<java.util.concurrent.ExecutorService>ArooaConversionException - If unable to provide a value.public int getLimit()
public void setLimit(int max)
public java.util.concurrent.ExecutorService getOriginal()
@Inject public void setOriginal(java.util.concurrent.ExecutorService original)
public java.lang.String toString()
toString in class java.lang.Object