javax.batch.api.chunk
Interface CheckpointAlgorithm

All Known Implementing Classes:
AbstractCheckpointAlgorithm

public interface CheckpointAlgorithm

CheckpointAlgorithm provides a custom checkpoint policy for chunk steps.


Method Summary
 void beginCheckpoint()
          The beginCheckpoint method is invoked before the next checkpoint interval begins.
 int checkpointTimeout()
          The checkpointTimeout is invoked at the beginning of a new checkpoint interval for the purpose of establishing the checkpoint transaction timeout.
 void endCheckpoint()
          The endCheckpoint method is invoked after the current checkpoint is committed.
 boolean isReadyToCheckpoint()
          The isReadyToCheckpoint method is invoked by the batch runtime after each item read to determine if now is the time to checkpoint the current chunk.
 

Method Detail

checkpointTimeout

int checkpointTimeout()
                      throws Exception
The checkpointTimeout is invoked at the beginning of a new checkpoint interval for the purpose of establishing the checkpoint transaction timeout. This method is invoked if and only if the chunk step to which it belongs is configured for global transactions. It is invoked before the next checkpoint transaction begins. It receives as input the value of the global mode timeout property of the current chunk step. This method returns an integer value, which is the timeout value that will be used for the next checkpoint transaction. This method is useful to automate the setting of the checkpoint timeout based on factors known outside the job definition. The following step properties are related to this method:

  1. javax.transaction.global.mode={true|false}
  2. javax.transaction.global.timeout={seconds} - default is 180 seconds

Parameters:
timeout - specifies the global timeout value for the next checkpoint interval
Returns:
the timeout interval to use for the next checkpoint interval
Throws:
Exception - thrown for any errors.

beginCheckpoint

void beginCheckpoint()
                     throws Exception
The beginCheckpoint method is invoked before the next checkpoint interval begins. If the step is configured for global mode transactions, this method receives control before the transaction is started.

Throws:
Exception - thrown for any errors.

isReadyToCheckpoint

boolean isReadyToCheckpoint()
                            throws Exception
The isReadyToCheckpoint method is invoked by the batch runtime after each item read to determine if now is the time to checkpoint the current chunk.

Returns:
boolean indicating whether or not to checkpoint now.
Throws:
Exception - thrown for any errors.

endCheckpoint

void endCheckpoint()
                   throws Exception
The endCheckpoint method is invoked after the current checkpoint is committed.

Throws:
Exception - thrown for any errors.


Copyright © 2013. All Rights Reserved.