Class TieredStaleRecordProcessor

All Implemented Interfaces:
Runnable, ManagedJob
Direct Known Subclasses:
TieredStoredProcedureStaleRecordProcessor

public abstract class TieredStaleRecordProcessor extends StaleRecordProcessor
Abstract job to process "stale" record tiers.

This job executes a JDBC procedure, which is expected to accept one or two arguments. The first argument is the configured tierProcessType. If tierProcessMax is not null then that will be passed as the second argument. The JDBC procedure must return an Integer result representing the number of rows processed by the call. If the procedure returns zero, the job stops immediately.

If taskCount is higher than 1 then taskCount tasks will be submitted to the configured

invalid reference
#getExecutorService()
. Depending on the configuration of that service, those tasks might execute in parallel.

The JobSupport.getParallelism() value will limit the overall number or stale tier rows processed in one invocation of

invalid reference
#handleJob(Event)
.

Since:
1.6
  • Constructor Details

    • TieredStaleRecordProcessor

      public TieredStaleRecordProcessor(org.springframework.jdbc.core.JdbcOperations jdbcOps, String taskDescription)
      Constructor.
      Parameters:
      jdbcOps - the JdbcOperations to use
      taskDescription - a description of the task to use in log statements
      Throws:
      IllegalArgumentException - if any argument is null
  • Method Details

    • execute

      protected abstract int execute(AtomicInteger remainingCount)
      Execute the stale processing task.
      Parameters:
      remainingCount - the maximum remaining number of rows to process
      Returns:
      number of rows processed
    • executeJobTask

      protected int executeJobTask(AtomicInteger remainingIterataions) throws Exception
      Description copied from class: JobSupport
      Execute a parallel job task.

      This method is called from the JobSupport.executeParallelJob(String) method by each thread. This method is supposed to execute up to remainingIterataions of the job's task, updating remainingIterataions as each iteration is processed. Keep in mind that each job task thread will be mutating (competing for) remainingIterataions.

      This method throws a UnsupportedOperationException and must be overridden by extending classes.

      Overrides:
      executeJobTask in class JobSupport
      Parameters:
      remainingIterataions - the number of iterations left to perform
      Returns:
      the number of iterations performed
      Throws:
      Exception - if any error occurs
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class StaleRecordProcessor
    • getTierProcessType

      public String getTierProcessType()
      Get the tier process type.
      Returns:
      the type; defaults to "h"
    • setTierProcessType

      public void setTierProcessType(String tierProcessType)
      Set the type of tier data to process.

      This is the first parameter passed to the JDBC procedure.

      Parameters:
      tierProcessType - the type to set
    • getTierProcessMax

      public Integer getTierProcessMax()
      Get the maximum tier rows to process per procedure call.
      Returns:
      the maximum row count, or null for no explicit limit
    • setTierProcessMax

      public void setTierProcessMax(Integer tierProcessMax)
      Set the maximum number of tier rows to process per procedure call.

      If this value is not null, then it will be passed as the second parameter passed to the JDBC procedure. When null then the JDBC procedure is expected to take only one argument.

      Parameters:
      tierProcessMax - the maximum number of rows, or null for no explicit limit; default is null