Mark fields as final where appropriate

This commit is contained in:
Mahmoud Ben Hassine
2023-07-04 21:45:20 +02:00
parent 241e37e672
commit 0a1cdb095f
166 changed files with 411 additions and 365 deletions

View File

@@ -36,11 +36,11 @@ import org.springframework.util.Assert;
*/
public class JobParameter<T> implements Serializable {
private T value;
private final T value;
private Class<T> type;
private final Class<T> type;
private boolean identifying;
private final boolean identifying;
/**
* Create a new {@link JobParameter}.

View File

@@ -44,7 +44,7 @@ public class StepContribution implements Serializable {
private ExitStatus exitStatus = ExitStatus.EXECUTING;
private volatile StepExecution stepExecution;
private final StepExecution stepExecution;
/**
* @param execution {@link StepExecution} the stepExecution used to initialize

View File

@@ -52,7 +52,7 @@ public abstract class AbstractApplicationContextFactory implements ApplicationCo
private static final Log logger = LogFactory.getLog(AbstractApplicationContextFactory.class);
private Object[] resources;
private final Object[] resources;
private ConfigurableApplicationContext parent;

View File

@@ -45,7 +45,7 @@ import org.springframework.util.Assert;
*/
public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, ApplicationContextAware, InitializingBean {
private Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>();
private final Collection<ApplicationContextFactory> applicationContextFactories = new ArrayList<>();
private JobLoader jobLoader;
@@ -57,7 +57,7 @@ public class AutomaticJobRegistrar implements Ordered, SmartLifecycle, Applicati
private boolean autoStartup = true;
private Object lifecycleMonitor = new Object();
private final Object lifecycleMonitor = new Object();
private int order = Ordered.LOWEST_PRECEDENCE;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,15 +50,15 @@ import org.springframework.util.Assert;
*/
public class DefaultJobLoader implements JobLoader, InitializingBean {
private static Log logger = LogFactory.getLog(DefaultJobLoader.class);
private static final Log logger = LogFactory.getLog(DefaultJobLoader.class);
private JobRegistry jobRegistry;
private StepRegistry stepRegistry;
private Map<ApplicationContextFactory, ConfigurableApplicationContext> contexts = new ConcurrentHashMap<>();
private final Map<ApplicationContextFactory, ConfigurableApplicationContext> contexts = new ConcurrentHashMap<>();
private Map<ConfigurableApplicationContext, Collection<String>> contextToJobNames = new ConcurrentHashMap<>();
private final Map<ConfigurableApplicationContext, Collection<String>> contextToJobNames = new ConcurrentHashMap<>();
/**
* Default constructor. Useful for declarative configuration.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ import org.springframework.batch.core.configuration.JobRegistry;
*/
public class JobFactoryRegistrationListener {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private JobRegistry jobRegistry;

View File

@@ -48,12 +48,12 @@ import org.springframework.util.Assert;
public class JobRegistryBeanPostProcessor
implements BeanPostProcessor, BeanFactoryAware, InitializingBean, DisposableBean {
private static Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class);
private static final Log logger = LogFactory.getLog(JobRegistryBeanPostProcessor.class);
// It doesn't make sense for this to have a default value...
private JobRegistry jobRegistry = null;
private Collection<String> jobNames = new HashSet<>();
private final Collection<String> jobNames = new HashSet<>();
private String groupName = null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.springframework.batch.core.configuration.JobFactory;
*/
public class ReferenceJobFactory implements JobFactory {
private Job job;
private final Job job;
/**
* @param job the {@link Job} to return from {@link #createJob()}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 the original author or authors.
* Copyright 2021-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,9 +29,9 @@ import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
public class ScopeConfiguration {
private static StepScope stepScope;
private static final StepScope stepScope;
private static JobScope jobScope;
private static final JobScope jobScope;
static {
jobScope = new JobScope();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
*/
public class JobParserJobFactoryBean implements SmartFactoryBean<FlowJob> {
private String name;
private final String name;
private Boolean restartable;

View File

@@ -114,7 +114,7 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
private PlatformTransactionManager transactionManager;
private Set<Object> stepExecutionListeners = new LinkedHashSet<>();
private final Set<Object> stepExecutionListeners = new LinkedHashSet<>();
//
// Flow Elements
@@ -154,7 +154,7 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
private Isolation isolation;
private Set<ChunkListener> chunkListeners = new LinkedHashSet<>();
private final Set<ChunkListener> chunkListeners = new LinkedHashSet<>();
//
// Chunk Attributes
@@ -204,13 +204,13 @@ public class StepParserStepFactoryBean<I, O> implements FactoryBean<Step>, BeanN
private ItemStream[] streams;
private Set<ItemReadListener<I>> readListeners = new LinkedHashSet<>();
private final Set<ItemReadListener<I>> readListeners = new LinkedHashSet<>();
private Set<ItemWriteListener<O>> writeListeners = new LinkedHashSet<>();
private final Set<ItemWriteListener<O>> writeListeners = new LinkedHashSet<>();
private Set<ItemProcessListener<I, O>> processListeners = new LinkedHashSet<>();
private final Set<ItemProcessListener<I, O>> processListeners = new LinkedHashSet<>();
private Set<SkipListener<I, O>> skipListeners = new LinkedHashSet<>();
private final Set<SkipListener<I, O>> skipListeners = new LinkedHashSet<>();
//
// Additional

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public abstract class AbstractJobExplorerFactoryBean implements FactoryBean<JobE
private TransactionAttributeSource transactionAttributeSource;
private ProxyFactory proxyFactory = new ProxyFactory();
private final ProxyFactory proxyFactory = new ProxyFactory();
/**
* Creates a job instance data access object (DAO).

View File

@@ -70,7 +70,7 @@ public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean imple
private String tablePrefix = AbstractJdbcBatchMetadataDao.DEFAULT_TABLE_PREFIX;
private DataFieldMaxValueIncrementer incrementer = new AbstractDataFieldMaxValueIncrementer() {
private final DataFieldMaxValueIncrementer incrementer = new AbstractDataFieldMaxValueIncrementer() {
@Override
protected long getNextKey() {
throw new IllegalStateException("JobExplorer is read only.");

View File

@@ -82,7 +82,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
private JobRepository jobRepository;
private CompositeJobExecutionListener listener = new CompositeJobExecutionListener();
private final CompositeJobExecutionListener listener = new CompositeJobExecutionListener();
private JobParametersIncrementer jobParametersIncrementer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ import org.springframework.batch.core.step.StepLocator;
*/
public class SimpleJob extends AbstractJob {
private List<Step> steps = new ArrayList<>();
private final List<Step> steps = new ArrayList<>();
/**
* Default constructor for job with null name

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,27 +47,28 @@ import org.springframework.core.task.TaskExecutor;
*
* @author Dave Syer
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 2.2
* @param <Q> the type of object returned by the builder (by default a Flow)
*
*/
public class FlowBuilder<Q> {
private String name;
private final String name;
private String prefix;
private final String prefix;
private List<StateTransition> transitions = new ArrayList<>();
private final List<StateTransition> transitions = new ArrayList<>();
private Map<String, State> tos = new HashMap<>();
private final Map<String, State> tos = new HashMap<>();
private State currentState;
private EndState failedState;
private final EndState failedState;
private EndState completedState;
private final EndState completedState;
private EndState stoppedState;
private final EndState stoppedState;
private int stepCounter = 0;
@@ -79,7 +80,7 @@ public class FlowBuilder<Q> {
private int endCounter = 0;
private Map<Object, State> states = new HashMap<>();
private final Map<Object, State> states = new HashMap<>();
private SimpleFlow flow;
@@ -606,7 +607,7 @@ public class FlowBuilder<Q> {
private final FlowBuilder<Q> parent;
private TaskExecutor executor;
private final TaskExecutor executor;
/**
* @param parent the parent builder

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +22,12 @@ import org.springframework.beans.factory.InitializingBean;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class JobFlowBuilder extends FlowBuilder<FlowJobBuilder> {
private FlowJobBuilder parent;
private final FlowJobBuilder parent;
public JobFlowBuilder(FlowJobBuilder parent) {
super(parent.getName());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,12 +27,13 @@ import org.springframework.util.Assert;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.2
*
*/
public class SimpleJobBuilder extends JobBuilderHelper<SimpleJobBuilder> {
private List<Step> steps = new ArrayList<>();
private final List<Step> steps = new ArrayList<>();
private JobFlowBuilder builder;

View File

@@ -42,7 +42,7 @@ public class FlowJob extends AbstractJob {
protected Flow flow;
private Map<String, Step> stepMap = new ConcurrentHashMap<>();
private final Map<String, Step> stepMap = new ConcurrentHashMap<>();
private volatile boolean initialized = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,9 +56,9 @@ public class SimpleFlow implements Flow, InitializingBean {
private State startState;
private Map<String, Set<StateTransition>> transitionMap = new HashMap<>();
private final Map<String, Set<StateTransition>> transitionMap = new HashMap<>();
private Map<String, State> stateMap = new HashMap<>();
private final Map<String, State> stateMap = new HashMap<>();
private List<StateTransition> stateTransitions = new ArrayList<>();

View File

@@ -46,7 +46,7 @@ public class SplitState extends AbstractState implements FlowHolder {
private TaskExecutor taskExecutor = new SyncTaskExecutor();
private FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator();
private final FlowExecutionAggregator aggregator = new MaxValueFlowExecutionAggregator();
/**
* @param flows collection of {@link Flow} instances.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ public class JobOperatorFactoryBean implements FactoryBean<JobOperator>, Initial
private JobParametersConverter jobParametersConverter = new DefaultJobParametersConverter();
private ProxyFactory proxyFactory = new ProxyFactory();
private final ProxyFactory proxyFactory = new ProxyFactory();
@Override
public void afterPropertiesSet() throws Exception {

View File

@@ -69,7 +69,7 @@ public class JobRegistryBackgroundJobRunner {
*/
public static final String EMBEDDED = JobRegistryBackgroundJobRunner.class.getSimpleName() + ".EMBEDDED";
private static Log logger = LogFactory.getLog(JobRegistryBackgroundJobRunner.class);
private static final Log logger = LogFactory.getLog(JobRegistryBackgroundJobRunner.class);
private JobLoader jobLoader;
@@ -81,7 +81,7 @@ public class JobRegistryBackgroundJobRunner {
private JobRegistry jobRegistry;
private static List<Exception> errors = Collections.synchronizedList(new ArrayList<>());
private static final List<Exception> errors = Collections.synchronizedList(new ArrayList<>());
/**
* @param parentContextPath the parentContextPath to be used by the

View File

@@ -38,7 +38,7 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
protected Log logger = LogFactory.getLog(getClass());
private Map<String, Integer> mapping;
private final Map<String, Integer> mapping;
public SimpleJvmExitCodeMapper() {
mapping = new HashMap<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,11 +25,12 @@ import org.springframework.core.Ordered;
/**
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*
*/
public class CompositeChunkListener implements ChunkListener {
private OrderedComposite<ChunkListener> listeners = new OrderedComposite<>();
private final OrderedComposite<ChunkListener> listeners = new OrderedComposite<>();
/**
* Default constructor

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
*/
public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T, S> {
private OrderedComposite<ItemProcessListener<? super T, ? super S>> listeners = new OrderedComposite<>();
private final OrderedComposite<ItemProcessListener<? super T, ? super S>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,11 +24,12 @@ import org.springframework.core.Ordered;
/**
* @author Lucas Ward
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeItemReadListener<T> implements ItemReadListener<T> {
private OrderedComposite<ItemReadListener<? super T>> listeners = new OrderedComposite<>();
private final OrderedComposite<ItemReadListener<? super T>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ import org.springframework.core.Ordered;
*/
public class CompositeItemWriteListener<S> implements ItemWriteListener<S> {
private OrderedComposite<ItemWriteListener<? super S>> listeners = new OrderedComposite<>();
private final OrderedComposite<ItemWriteListener<? super S>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,11 +24,12 @@ import org.springframework.core.Ordered;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeJobExecutionListener implements JobExecutionListener {
private OrderedComposite<JobExecutionListener> listeners = new OrderedComposite<>();
private final OrderedComposite<JobExecutionListener> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,12 @@ import org.springframework.core.Ordered;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeSkipListener<T, S> implements SkipListener<T, S> {
private OrderedComposite<SkipListener<? super T, ? super S>> listeners = new OrderedComposite<>();
private final OrderedComposite<SkipListener<? super T, ? super S>> listeners = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,11 +27,12 @@ import org.springframework.lang.Nullable;
/**
* @author Lucas Ward
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class CompositeStepExecutionListener implements StepExecutionListener {
private OrderedComposite<StepExecutionListener> list = new OrderedComposite<>();
private final OrderedComposite<StepExecutionListener> list = new OrderedComposite<>();
/**
* Public setter for the listeners.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,17 +41,17 @@ import org.springframework.lang.Nullable;
public class MulticasterBatchListener<T, S> implements StepExecutionListener, ChunkListener, ItemReadListener<T>,
ItemProcessListener<T, S>, ItemWriteListener<S>, SkipListener<T, S> {
private CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener();
private final CompositeStepExecutionListener stepListener = new CompositeStepExecutionListener();
private CompositeChunkListener chunkListener = new CompositeChunkListener();
private final CompositeChunkListener chunkListener = new CompositeChunkListener();
private CompositeItemReadListener<T> itemReadListener = new CompositeItemReadListener<>();
private final CompositeItemReadListener<T> itemReadListener = new CompositeItemReadListener<>();
private CompositeItemProcessListener<T, S> itemProcessListener = new CompositeItemProcessListener<>();
private final CompositeItemProcessListener<T, S> itemProcessListener = new CompositeItemProcessListener<>();
private CompositeItemWriteListener<S> itemWriteListener = new CompositeItemWriteListener<>();
private final CompositeItemWriteListener<S> itemWriteListener = new CompositeItemWriteListener<>();
private CompositeSkipListener<T, S> skipListener = new CompositeSkipListener<>();
private final CompositeSkipListener<T, S> skipListener = new CompositeSkipListener<>();
/**
* Initialize the listener instance.

View File

@@ -33,13 +33,13 @@ import org.springframework.core.annotation.Order;
*/
class OrderedComposite<S> {
private List<S> unordered = new ArrayList<>();
private final List<S> unordered = new ArrayList<>();
private List<S> ordered = new ArrayList<>();
private final List<S> ordered = new ArrayList<>();
private Comparator<? super S> comparator = new AnnotationAwareOrderComparator();
private final Comparator<? super S> comparator = new AnnotationAwareOrderComparator();
private List<S> list = new ArrayList<>();
private final List<S> list = new ArrayList<>();
/**
* Public setter for the listeners.

View File

@@ -129,7 +129,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
private DataFieldMaxValueIncrementer jobInstanceIncrementer;
private JobKeyGenerator<JobParameters> jobKeyGenerator = new DefaultJobKeyGenerator();
private final JobKeyGenerator<JobParameters> jobKeyGenerator = new DefaultJobKeyGenerator();
/**
* In this JDBC implementation a job instance id is obtained by asking the
@@ -235,7 +235,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
ResultSetExtractor<List<JobInstance>> extractor = new ResultSetExtractor<>() {
private List<JobInstance> list = new ArrayList<>();
private final List<JobInstance> list = new ArrayList<>();
@Override
public List<JobInstance> extractData(ResultSet rs) throws SQLException, DataAccessException {
@@ -372,7 +372,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
public List<JobInstance> findJobInstancesByName(String jobName, final int start, final int count) {
@SuppressWarnings("rawtypes")
ResultSetExtractor extractor = new ResultSetExtractor() {
private List<JobInstance> list = new ArrayList<>();
private final List<JobInstance> list = new ArrayList<>();
@Override
public Object extractData(ResultSet rs) throws SQLException, DataAccessException {

View File

@@ -55,7 +55,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean<Jo
private TransactionAttributeSource transactionAttributeSource;
private ProxyFactory proxyFactory = new ProxyFactory();
private final ProxyFactory proxyFactory = new ProxyFactory();
private String isolationLevelForCreate = DEFAULT_ISOLATION_LEVEL;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,13 +52,14 @@ import org.springframework.beans.factory.config.Scope;
* @author Dave Syer
* @author Jimmy Praet (create JobScope based on {@link StepScope})
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 3.0
*/
public class JobScope extends BatchScopeSupport {
private static final String TARGET_NAME_PREFIX = "jobScopedTarget.";
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private final Object mutex = new Object();

View File

@@ -59,13 +59,14 @@ import org.springframework.beans.factory.config.Scope;
*
* @author Dave Syer
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class StepScope extends BatchScopeSupport {
private static final String TARGET_NAME_PREFIX = "scopedTarget.";
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private final Object mutex = new Object();

View File

@@ -49,9 +49,9 @@ import org.springframework.util.Assert;
*/
public class JobContext extends SynchronizedAttributeAccessor {
private JobExecution jobExecution;
private final JobExecution jobExecution;
private Map<String, Set<Runnable>> callbacks = new HashMap<>();
private final Map<String, Set<Runnable>> callbacks = new HashMap<>();
public JobContext(JobExecution jobExecution) {
super();

View File

@@ -51,9 +51,9 @@ import org.springframework.util.Assert;
*/
public class StepContext extends SynchronizedAttributeAccessor {
private StepExecution stepExecution;
private final StepExecution stepExecution;
private Map<String, Set<Runnable>> callbacks = new HashMap<>();
private final Map<String, Set<Runnable>> callbacks = new HashMap<>();
/**
* Create a new instance of {@link StepContext} for this {@link StepExecution}.

View File

@@ -74,7 +74,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
private boolean allowStartIfComplete = false;
private CompositeStepExecutionListener stepExecutionListener = new CompositeStepExecutionListener();
private final CompositeStepExecutionListener stepExecutionListener = new CompositeStepExecutionListener();
private JobRepository jobRepository;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ public abstract class AbstractTaskletStepBuilder<B extends AbstractTaskletStepBu
private TransactionAttribute transactionAttribute;
private Set<ItemStream> streams = new LinkedHashSet<>();
private final Set<ItemStream> streams = new LinkedHashSet<>();
private ExceptionHandler exceptionHandler = new DefaultExceptionHandler();

View File

@@ -94,7 +94,7 @@ import org.springframework.util.Assert;
*/
public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
private ChunkMonitor chunkMonitor = new ChunkMonitor();
private final ChunkMonitor chunkMonitor = new ChunkMonitor();
private boolean streamIsReader;
@@ -102,7 +102,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
private BackOffPolicy backOffPolicy;
private Set<RetryListener> retryListeners = new LinkedHashSet<>();
private final Set<RetryListener> retryListeners = new LinkedHashSet<>();
private RetryPolicy retryPolicy;
@@ -110,17 +110,17 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
private KeyGenerator keyGenerator;
private Collection<Class<? extends Throwable>> noRollbackExceptionClasses = new LinkedHashSet<>();
private final Collection<Class<? extends Throwable>> noRollbackExceptionClasses = new LinkedHashSet<>();
private Map<Class<? extends Throwable>, Boolean> skippableExceptionClasses = new HashMap<>();
private final Map<Class<? extends Throwable>, Boolean> skippableExceptionClasses = new HashMap<>();
private Collection<Class<? extends Throwable>> nonSkippableExceptionClasses = new HashSet<>();
private Map<Class<? extends Throwable>, Boolean> retryableExceptionClasses = new HashMap<>();
private final Map<Class<? extends Throwable>, Boolean> retryableExceptionClasses = new HashMap<>();
private Collection<Class<? extends Throwable>> nonRetryableExceptionClasses = new HashSet<>();
private Set<SkipListener<? super I, ? super O>> skipListeners = new LinkedHashSet<>();
private final Set<SkipListener<? super I, ? super O>> skipListeners = new LinkedHashSet<>();
private int skipLimit = 0;
@@ -696,7 +696,7 @@ public class FaultTolerantStepBuilder<I, O> extends SimpleStepBuilder<I, O> {
*/
private static class TerminateOnExceptionChunkListenerDelegate implements ChunkListener {
private ChunkListener chunkListener;
private final ChunkListener chunkListener;
TerminateOnExceptionChunkListenerDelegate(ChunkListener chunkListener) {
this.chunkListener = chunkListener;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,11 +31,12 @@ import org.springframework.batch.item.support.CompositeItemStream;
* wrapped {@link ItemStream}.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @since 2.0
*/
public class ChunkMonitor extends ItemStreamSupport {
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private boolean streamsRegistered = false;
@@ -54,9 +55,9 @@ public class ChunkMonitor extends ItemStreamSupport {
private static final String OFFSET = "OFFSET";
private CompositeItemStream stream = new CompositeItemStream();
private final CompositeItemStream stream = new CompositeItemStream();
private ThreadLocal<ChunkMonitorData> holder = new ThreadLocal<>();
private final ThreadLocal<ChunkMonitorData> holder = new ThreadLocal<>();
private ItemReader<?> reader;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class ChunkOrientedTasklet<I> implements Tasklet {
private boolean buffering = true;
private static Log logger = LogFactory.getLog(ChunkOrientedTasklet.class);
private static final Log logger = LogFactory.getLog(ChunkOrientedTasklet.class);
public ChunkOrientedTasklet(ChunkProvider<I> chunkProvider, ChunkProcessor<I> chunkProcessor) {
this.chunkProvider = chunkProvider;

View File

@@ -61,7 +61,7 @@ public class FaultTolerantChunkProcessor<I, O> extends SimpleChunkProcessor<I, O
private Classifier<Throwable, Boolean> rollbackClassifier = new BinaryExceptionClassifier(true);
private Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
private boolean buffering = true;

View File

@@ -79,12 +79,12 @@ public class TaskletStep extends AbstractStep {
private RepeatOperations stepOperations = new RepeatTemplate();
private CompositeChunkListener chunkListener = new CompositeChunkListener();
private final CompositeChunkListener chunkListener = new CompositeChunkListener();
// default to checking current thread for interruption.
private StepInterruptionPolicy interruptionPolicy = new ThreadStepInterruptionPolicy();
private CompositeItemStream stream = new CompositeItemStream();
private final CompositeItemStream stream = new CompositeItemStream();
private PlatformTransactionManager transactionManager;