Class TieredStaleRecordProcessor
- All Implemented Interfaces:
Runnable,ManagedJob
- Direct Known Subclasses:
TieredStoredProcedureStaleRecordProcessor
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()
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
-
Field Summary
Fields inherited from class net.solarnetwork.central.scheduler.JobSupport
DEFAULT_CRON, DEFAULT_JITTER, DEFAULT_MAX_ITERATIONS, DEFAULT_MAX_WAIT, DEFAULT_PARALLELISM, log -
Constructor Summary
ConstructorsConstructorDescriptionTieredStaleRecordProcessor(org.springframework.jdbc.core.JdbcOperations jdbcOps, String taskDescription) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intexecute(AtomicInteger remainingCount) Execute the stale processing task.protected intexecuteJobTask(AtomicInteger remainingIterataions) Execute a parallel job task.Get the maximum tier rows to process per procedure call.Get the tier process type.voidrun()voidsetTierProcessMax(Integer tierProcessMax) Set the maximum number of tier rows to process per procedure call.voidsetTierProcessType(String tierProcessType) Set the type of tier data to process.Methods inherited from class net.solarnetwork.central.common.job.JdbcCallJob
getJdbcCall, getJdbcOps, setJdbcCallMethods inherited from class net.solarnetwork.central.scheduler.JobSupport
executeParallelJob, getGroupId, getId, getJitter, getMaximumIterations, getMaximumWaitMs, getParallelism, getParallelTaskExecutor, getSchedule, setGroupId, setId, setJitter, setMaximumIterations, setMaximumWaitMs, setParallelism, setParallelTaskExecutor, setSchedule
-
Constructor Details
-
TieredStaleRecordProcessor
public TieredStaleRecordProcessor(org.springframework.jdbc.core.JdbcOperations jdbcOps, String taskDescription) Constructor.- Parameters:
jdbcOps- the JdbcOperations to usetaskDescription- a description of the task to use in log statements- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
execute
Execute the stale processing task.- Parameters:
remainingCount- the maximum remaining number of rows to process- Returns:
- number of rows processed
-
executeJobTask
Description copied from class:JobSupportExecute a parallel job task.This method is called from the
JobSupport.executeParallelJob(String)method by each thread. This method is supposed to execute up toremainingIterataionsof the job's task, updatingremainingIterataionsas each iteration is processed. Keep in mind that each job task thread will be mutating (competing for)remainingIterataions.This method throws a
UnsupportedOperationExceptionand must be overridden by extending classes.- Overrides:
executeJobTaskin classJobSupport- 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:
runin interfaceRunnable- Overrides:
runin classStaleRecordProcessor
-
getTierProcessType
Get the tier process type.- Returns:
- the type; defaults to "h"
-
setTierProcessType
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
Get the maximum tier rows to process per procedure call.- Returns:
- the maximum row count, or null for no explicit limit
-
setTierProcessMax
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
-