Skip to content

Commit 6ba7c63

Browse files
committed
Clarify documentation about throttling deprecation
Resolves #4389
1 parent 42dd144 commit 6ba7c63

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/modules/ROOT/pages/scalability.adoc

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

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

0 commit comments

Comments
 (0)