public class PurgeBatchlet extends Object implements javax.batch.api.Batchlet
Most batch properties in this class work with all types of batch job repositories.
Some batch properties are specific to certain type of job repository. For instance,
sql
and sqlFile
only work with jdbc job repository,
mongoRemoveQueries
only works with MongoDB job repository.
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
batchStatuses
Specifies one or more batch status values separated by comma (,), and job executions
whose batch status matches (case sensitive) any of the specified values will be removed.
|
protected Set<String> |
exitStatuses
Specifies one or more exit status values separated by comma (,), and job executions
whose exit status matches (case sensitive) any of the specified values will be removed.
|
protected javax.batch.runtime.context.JobContext |
jobContext
Injected job context of the current job execution.
|
protected Date |
jobExecutionEndTimeFrom
Specifies the starting value of the end time of a job execution, and any
job executions whose end time is equal to or later than that starting value
will be removed.
|
protected Date |
jobExecutionEndTimeTo
Specifies the end value of the end time of a job execution, and any
job executions whose end time is equal to or earlier than that end value
will be removed.
|
protected Long |
jobExecutionIdFrom
Specifies the starting value of job execution id, and all job executions whose id
equals to or is greater than this starting value will be removed.
|
protected Set<Long> |
jobExecutionIds
Specifies one or more job executions ids, and job data for these job executions
will be removed.
|
protected Long |
jobExecutionIdTo
Specifies the end value of job execution id, and all job executions whose id
equals to or is less than this end value will be removed.
|
protected Set<String> |
jobExecutionsByJobNames
Specifies one or more job names separated by comma (,), and job executions
belonging to any of the specified job names will be removed.
|
protected Class |
jobExecutionSelector
Fully-qualified name of a class implementing
org.jberet.repository.JobExecutionSelector , which gives
application flexibility in filtering job execution data. |
protected Boolean |
keepRunningJobExecutions
Whether or not to keep job data belonging to all running job executions.
|
protected String |
mongoRemoveQueries
One or more MongoDB remove queries delimited by semi-colon (;) for removing
certain job data.
|
protected Integer |
numberOfRecentJobExecutionsToKeep
Specifies the number of most recent job executions to keep, and other
job executions will be removed.
|
protected Set<String> |
purgeJobsByNames
Specifies one or more job names separated by comma (,), and job information
for those job names in the batch runtime will be removed.
|
protected String |
sql
One or more sql statements for removing certain job data.
|
protected String |
sqlFile
Path to the resource file that contains one or more sql statements for removing
certain job data.
|
protected javax.batch.runtime.context.StepContext |
stepContext
Injected step context of the current step execution.
|
protected Integer |
withinPastMinutes
Specifies the number of minutes after the end time of a job execution, and
any job executions that end within that number of minutes will be removed.
|
Constructor and Description |
---|
PurgeBatchlet() |
Modifier and Type | Method and Description |
---|---|
protected JdbcRepository |
getJdbcRepository(JobRepository repo)
Gets the
org.jberet.repository.JdbcRepository from the
org.jberet.repository.JobRepository passed in, in order to
perform operations specific to org.jberet.repository.JdbcRepository . |
String |
process() |
void |
stop() |
@Inject protected javax.batch.runtime.context.JobContext jobContext
@Inject protected javax.batch.runtime.context.StepContext stepContext
@Inject protected String sql
sqlFile
@Inject protected String sqlFile
This property is similar to sql
, except that the sql statements are in
a separate resource file. Therefore, only one of them should be configured in a
given step. When both are present, sql
property is used and sqlFile
is ignored.
sql
@Inject protected String mongoRemoveQueries
db.PARTITION_EXECUTION.remove({ STEPEXECUTIONID: { $gt: 100 } }); db.STEP_EXECUTION.remove({ STEPEXECUTIONID: { $gt: 100 } }); db.JOB_EXECUTION.remove({ JOBEXECUTIONID: { $gt: 10 } }); db.JOB_INSTANCE.remove({ JOBINSTANCEID: { $gt: 10 } })
@Inject protected Class jobExecutionSelector
org.jberet.repository.JobExecutionSelector
, which gives
application flexibility in filtering job execution data.
If this property is present, other batch properties related to job execution in this class are ignored.
@Inject protected Boolean keepRunningJobExecutions
@Inject protected Set<Long> jobExecutionIds
@Inject protected Integer numberOfRecentJobExecutionsToKeep
@Inject protected Long jobExecutionIdFrom
jobExecutionIdTo
to form a range of
job execution ids. If jobExecutionIdTo
is not specified, the range
is up to the maximum job execution id.jobExecutionIdTo
@Inject protected Long jobExecutionIdTo
jobExecutionIdFrom
to form a range of
job execution ids. If jobExecutionIdFrom
is not specified, the range
starts from 1.jobExecutionIdFrom
@Inject protected Integer withinPastMinutes
@Inject protected Date jobExecutionEndTimeFrom
jobExecutionEndTimeTo
to form a range of job execution end time.
For example,
jobExecutionEndTimeTo
@Inject protected Date jobExecutionEndTimeTo
jobExecutionEndTimeFrom
to form a range of job execution end time.
For example,
jobExecutionEndTimeFrom
@Inject protected Set<String> batchStatuses
@Inject protected Set<String> exitStatuses
@Inject protected Set<String> jobExecutionsByJobNames
@Inject protected Set<String> purgeJobsByNames
For example,
public String process() throws Exception
process
in interface javax.batch.api.Batchlet
Exception
public void stop() throws Exception
stop
in interface javax.batch.api.Batchlet
Exception
protected JdbcRepository getJdbcRepository(JobRepository repo)
org.jberet.repository.JdbcRepository
from the
org.jberet.repository.JobRepository
passed in, in order to
perform operations specific to org.jberet.repository.JdbcRepository
.repo
- JobRepository
org.jberet.repository.JdbcRepository
Copyright © 2018 JBoss by Red Hat. All rights reserved.