com.ibm.wsspi.batch
Interface CheckpointPolicyAlgorithm

All Known Implementing Classes:
recordbased, timebased, TimeRecordBased

public interface CheckpointPolicyAlgorithm

CheckPointPolicy algorithms determine when a Batch Execution Environment commits the global transaction when it is invoking the Batch Step Bean by calling the Step Bean's processJobStep method in a batch loop. This SPI allows for the creation of customized checkpoint algorithms which can be applied to particular batch jobs when they are submitted to the job scheduler.


Method Summary
 java.lang.String getAlgorithmName()
          Returns the name of the checkpoint algorithm
 int getRecommendedTimeOutValue()
          Called by the Batch Execution Environment to determine the timeout for global transactions that it manages for the batch loop.
 boolean initialize(CheckpointAlgorithm ckpt)
          Called by the Batch Execution Environment to allow a Checkpoint algorithm to retrieve properties defined for the algorithm in xJCL (eg: interval for committing global transactions for a time base checkpoint algorithm) and to do any other initialization tasks.
 boolean ShouldCheckpointBeExecuted()
          Called by the Batch Execution Environment on each iteration of the batch loop to determine if the global transaction under which the processJobStep method is invoked should be committed or not.
 void startCheckpoint()
          Called by the Batch Execution Environment when it starts a global transaction.
 void stopCheckpoint()
          Called by the Batch Execution Environment when it commits a global transaction.
 

Method Detail

initialize

boolean initialize(CheckpointAlgorithm ckpt)
Called by the Batch Execution Environment to allow a Checkpoint algorithm to retrieve properties defined for the algorithm in xJCL (eg: interval for committing global transactions for a time base checkpoint algorithm) and to do any other initialization tasks. The CheckpointAlgorithm object passed in represents the Checkpoint information from xJCL.

Parameters:
ckpt - the CheckpointAlgorithm information that is specified in xJCL.
Returns:
boolean indicating if the algorithm was initialized successfully

getAlgorithmName

java.lang.String getAlgorithmName()
Returns the name of the checkpoint algorithm

Returns:
the name of the Checkpoint algorithm

ShouldCheckpointBeExecuted

boolean ShouldCheckpointBeExecuted()
Called by the Batch Execution Environment on each iteration of the batch loop to determine if the global transaction under which the processJobStep method is invoked should be committed or not. For example if this is a time based checkpoint algorithm, this method will calculate if enough time has passed between the previous commit time and the current time to determine if the transaction should be committed or not.

Returns:
a boolean indicating if the Batch Execution Environment should commit the global transaction

getRecommendedTimeOutValue

int getRecommendedTimeOutValue()
Called by the Batch Execution Environment to determine the timeout for global transactions that it manages for the batch loop.

Returns:
the timeout value for global transactions that are started by the Batch Execution Environment.

startCheckpoint

void startCheckpoint()
Called by the Batch Execution Environment when it starts a global transaction. This allows a checkpoint algorithm to keep track of the fact that a transaction has started (e.g. if it's a time based algorithm, it will remember at what time the Batch Execution Environment started the transaction, so when ShouldCheckpointBeExecuted is called, it can calculate if the global transaction should be committed or not).


stopCheckpoint

void stopCheckpoint()
Called by the Batch Execution Environment when it commits a global transaction. This allows a checkpoint algorithm to keep track of the fact that a transaction has been committed.