From 1ff04d532dfcaec0e86ad970e5c0195af2161fe8 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 12 Oct 2022 18:57:18 +0200 Subject: [PATCH] Deprecate throttle limit in TaskExecutorRepeatTemplate Resolves #2218 --- .../core/step/builder/AbstractTaskletStepBuilder.java | 5 +++++ .../batch/repeat/support/TaskExecutorRepeatTemplate.java | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java index 31697bc3f3..fb18a1f760 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/AbstractTaskletStepBuilder.java @@ -199,7 +199,11 @@ public B taskExecutor(TaskExecutor taskExecutor) { * in the job repository for this step. * @param throttleLimit maximum number of concurrent tasklet executions allowed * @return this for fluent chaining + * @deprecated since 5.0, scheduled for removal in 6.0. Use a pooled + * {@link TaskExecutor} implemenation with a limited capacity of its task queue + * instead. */ + @Deprecated(since = "5.0", forRemoval = true) public B throttleLimit(int throttleLimit) { this.throttleLimit = throttleLimit; return self(); @@ -280,6 +284,7 @@ protected TaskExecutor getTaskExecutor() { return taskExecutor; } + @Deprecated(since = "5.0", forRemoval = true) protected int getThrottleLimit() { return throttleLimit; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java index e80e3c75a5..5efd053203 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2022 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,6 +43,7 @@ * any given time, and each thread would have its own transaction).
* * @author Dave Syer + * @author Mahmoud Ben Hassine * */ public class TaskExecutorRepeatTemplate extends RepeatTemplate { @@ -68,7 +69,11 @@ public class TaskExecutorRepeatTemplate extends RepeatTemplate { * being reached (so make the core pool size larger than the throttle limit if * possible). * @param throttleLimit the throttleLimit to set. + * @deprecated since 5.0, scheduled for removal in 6.0. Use a pooled + * {@link TaskExecutor} implemenation with a limited capacity of its task queue + * instead. */ + @Deprecated(since = "5.0", forRemoval = true) public void setThrottleLimit(int throttleLimit) { this.throttleLimit = throttleLimit; }