com.ibm.wsspi.batch
Interface ResultsAlgorithm
- All Known Implementing Classes:
- jobsum
public interface ResultsAlgorithm
Results Algorithms are an optional feature of the batch programming model. A results algorithm
allows for two types of actions to occur at the end of a batch step:
- To influence the return code of the batch job based on the return code of the batch step that just ended.
Note that there are two types of return codes: the return code of an individual batch step and the return
code of the batch job to which the step belongs.
- To provide a place holder for triggers or actions to take based on various step return codes.
Results Algorithms are applied to a batch job via xJCL. They are declared in xJCL and then applied to batch steps.
Note that multiple results algorithms can be applied to a batch step.
At the end of a batch step, the batch execution environment checks the xJCL of the batch job to see which results
algorithms to invoke. For each results algorithm specified, the Batch Execution Environment passes to the algorithm the return code of the
batch step - the integer returned by the destroyJobStep method of the step - and the current return code of the batch Job
in the grid endpoint database. The results algorithm can then take any action based upon the return codes passed in.
The algorithm then passes a return code for the batch job back to the Batch Execution Environment which is persisted to the grid endpoint database
as the current return code of the batch job; this return code can be the same as the return code that the Batch Execution Environment
passed to the results algorithm in the first place or it can be different depending on logic coded into the results algorithm.
This SPI can be used to create custom Result Algorithms.
Method Summary |
int |
fireResultsAlgorithms(java.lang.String jobid,
java.lang.String stepname,
int steprc,
int jobrc)
Called by the Batch Execution Environment at the end of the batch step to which the results algorithm is applied. |
java.lang.String |
getalgorithmName()
Returns the algorithm name |
boolean |
initialize(ResultsAlgorithm result)
Called by Batch Execution Environment to initialize the Results Algorithm. |
initialize
boolean initialize(ResultsAlgorithm result)
- Called by Batch Execution Environment to initialize the Results Algorithm. The com.ibm.wsspi.batch.xjcl.ResultsAlgorithm object
represents the configuration data of the ResultsAlgorithm specified in xJCL.
- Parameters:
result
- The ResultsAlgorithm configuration data from xJCL
- Returns:
- boolean indicating if the algorithm was initialized
successfully
getalgorithmName
java.lang.String getalgorithmName()
- Returns the algorithm name
- Returns:
- algorithm name
fireResultsAlgorithms
int fireResultsAlgorithms(java.lang.String jobid,
java.lang.String stepname,
int steprc,
int jobrc)
- Called by the Batch Execution Environment at the end of the batch step to which the results algorithm is applied.
The return code returned by the destroyJobStep method of the step is passed in and
the current return code of the batch job in the grid endpoint database is also passed in.
This enables the results algorithm to fire triggers for certain return codes.
The integer returned by this method becomes the return code of the batch job; this allows
the implementer of this algorithm to influence the return code of the batch job based
on the step return code and the current job return code.
- Parameters:
jobid
- The id of the job.stepname
- The name of step.steprc
- The return code of the batch step for which this algorithm is being fired.result
- The current return code of the batch job
- Returns:
- boolean indicating if the algorithm was initialized
successfully