In order to make the Map based JobRepository threadsafe, the
JobExecutino was modified to use a `CopyOnWriteArraySet` for the
collection backing the child `StepExecution` collection. However, this
collection option has bad performance characteristics when used with
large collections. When using partitioning, it can be common to have a
large number of `StepExecution` instances to add which drastically hurts
start up time.
This commit remove the use of the `CopyOnWriteArraySet` for the
`JobExecution#stepExecutions` and replaces it with a `LinkedHashSet`
wrapped via `Collection.synchronizedSet`.
Resolves BATCH-2384
Why:
Listeners should be called in normal order before some event
(i.e. read, write) and after that event in reverse order.
Side effects:
The ordering of Chunk and ItemReader Listeners is changed and will
change some behaviors of users. This change is still neccesary because
it is not only the correct and obviouse way, but also prevents new
users to hack around this problem.
In a previous commit, the JobParametersBuilder was updated to include
some code from Spring Boot that handled the incrementing of
JobParameters for a previous job. That commit brought over a private
`merge` method that is actually useful for general consumption.
This commit adds a `addJobParameters` method to the builder providing
the same functionality the `merge` method did in a public method.
This commit adds a new `ItemProcessor` that delegates to a
`java.util.function.Function`. It also enables users to configure a
`Function` as an `ItemProcessor` via the builders (so they don't need to
worry about the `ItemProcessor` wrapper in the first place).
Resolves BATCH-2641
The current default for serializing the ExecutionContext is via XStream
using Jettison's driver. However, recent updates to Jettison make it
incompatible with XStream with no progress on a fix. Because of this,
and to encourage the use of well supported library combinations, the
default ExecutionContext serialization mechanism for Spring Batch has
been switched to Jackson (via the
Jackson2ExecutionContextStringSerializer). This commit also depricates
the XStreamExecutionContextStringSerializer for removal at a later date.
However, it is still available for users that require that during a
migration.
Resolves BATCH-2575
Spring Batch's implementation of JSR-352 previously relied on Spring's
ContextSingletonBeanFactoryLocator. However, this has been removed in
Spring 5 as a relic of older EJB based use cases. This commit now
lazily bootstraps the base context on it's own when the first
JsrJobOperator is requested.
Resolves BATCH-2572
The exception message for the Serializable check in
DefaultExecutionContextSerializer is always generated. For large
contexts this can quickly put a log of pressure on the allocator and
the heap.
This commit contains the following changes:
* generate the exception message for non-serializable values in
DefaultExecutionContextSerializer only when needed
I have signed and agree to the terms of the SpringSource Individual
Contributor License Agreement.
Issue: BATCH-2396
This commit moves all SNAPSHOT dependencies to the latest available
released versions. It also addresses a number of deprications in the
Spring Data realm. Specifically around the deprication of the
Neo4JOperations and the package reorganization within Hibernate.
When determining if an exception should be skipped or not, the business
exception should be used. However, when an exception is thrown in the
listener, it's wrapped by a `StepListenerFailedException`. This leads
to it hiding the underlying exception. This commit will unwrap the
cause of a `StepListenerFailedException` and use that to determine if it
should be skipped or not.
Resolves BATCH-2322
Prior to this commit, when using the `JobStep`, if the child job was
stopped (left in the `STOPPED` state), the step executing that job was
marked as `COMPLETE`, preventing it from being restarted. This commit
now marks a step that was executing the stopped job also as stopped,
allowing for it to be restarted.
Resolves BATCH-2429
Previously, AutomaticJobRegistrar listened to all ApplicationEvents
despite only being interested in two ApplicationContextEvents, namely
ContextRefreshedEvent and ContextClosedEvent. This could lead to
an AutomaticJobRegistrar instance being created earlier than necessary.
This commits tightens up AutomaticJobRegistrar so that it only listens
to ApplicationContextEvents.
Closes BATCH-2506
See https://github.com/spring-projects/spring-boot/issues/2395
It has been tested with Jackson 2.3.3 which is the Jackson version
used with the Spring dependency.
Tests have been updated to use Hamcrest matchers and made a bit more reusable.
With Java 1.5 StringBuilder is preferred over StringBuffer for single
threaded access as is has less overhead.
This is evidenced by the class comment of StringBuffer and Effective
Java 2nd Edition Item 67: Avoid excessive synchronization.
> The StringBuilder class should generally be used in preference to
> this one, as it supports all of the same operations but it is faster,
> as it performs no synchronization.
- replace StringBuffer with StringBuilder where possible
Issue: BATCH-2407
In various places in the code base a debug message is constructed
unconditionally. This adds unnecessary overhead in the common case when
debug logging is off.
- add guards around debug statements in non-test code
Issue: BATCH-2412
This is a follow-on from adc2f79. It removes the remaining references
to ParameterizedRowMapper and should, therefore, make things fully
compatible with Spring Framework 4.2.
UNKNOWN
* additionally prevent restart of step executions with status STARTING,
STARTED or STOPPING
* additionally prevent restart of job executions with status UNKNOWN or
STOPPING
InnoDB is the only option for transactional tables in MySql. This
change makes all the table definitions consistent (there previously were
a few that were MyISAM).
BATCH-2373
To support Spring Framework 4.2 which removes ParameterizedRowMapper,
all references to that were switched to RowMapper. As of Spring 3, the
interfaces are identicle so this should cause no backward compatability
issues.
BATCH-2369