Skip to content

Commit 4610bda

Browse files
committed
Clarify documentation about throttling deprecation
Resolves #4389 (cherry picked from commit 6ba7c63)
1 parent f40dd9f commit 4610bda

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ public B taskExecutor(TaskExecutor taskExecutor) {
199199
* in the job repository for this step.
200200
* @param throttleLimit maximum number of concurrent tasklet executions allowed
201201
* @return this for fluent chaining
202-
* @deprecated since 5.0, scheduled for removal in 6.0. Use a pooled
203-
* {@link TaskExecutor} implementation with a limited capacity of its task queue
204-
* instead.
202+
* @deprecated with no replacement since 5.0, scheduled for removal in 6.0. Use a custom
203+
* {@link RepeatOperations} implementation (based on a {@link TaskExecutor} with a bounded
204+
* task queue) and set it on the step with {@link #stepOperations(RepeatOperations)}.
205205
*/
206206
@Deprecated(since = "5.0", forRemoval = true)
207207
public B throttleLimit(int throttleLimit) {

spring-batch-docs/src/main/asciidoc/scalability.adoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,29 @@ Note also that there may be limits placed on concurrency by any pooled resources
121121
your step, such as a `DataSource`. Be sure to make the pool in those resources at least
122122
as large as the desired number of concurrent threads in the step.
123123

124+
[WARNING]
125+
.Throttle limit deprecation
126+
====
127+
As of v5.0, the throttle limit is deprecated with no replacement. If you want to replace the
128+
current throttling mechanism in the default `TaskExecutorRepeatTemplate`, you need to provide
129+
a custom `RepeatOperations` implementation (based on a `TaskExecutor` with a bounded task queue)
130+
and set it on the step with `StepBuilder#stepOperations`:
131+
132+
.Java Configuration
133+
[source, java]
134+
----
135+
@Bean
136+
public Step sampleStep(RepeatOperations customRepeatOperations, JobRepository jobRepository, PlatformTransactionManager transactionManager) {
137+
return new StepBuilder("sampleStep", jobRepository)
138+
.<String, String>chunk(10, transactionManager)
139+
.reader(itemReader())
140+
.writer(itemWriter())
141+
.stepOperations(customRepeatOperations)
142+
.build();
143+
}
144+
----
145+
====
146+
124147
There are some practical limitations of using multi-threaded `Step` implementations for
125148
some common batch use cases. Many participants in a `Step` (such as readers and writers)
126149
are stateful. If the state is not segregated by thread, those components are not

0 commit comments

Comments
 (0)