diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java
index a9adcc823d5..8d295684407 100644
--- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java
+++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-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.
@@ -171,6 +171,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
}
}
+ @Deprecated
@Override
public void execute(Runnable task, long startTimeout) {
execute(task);
diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java
index 35534962d9f..6cfa717398e 100644
--- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java
+++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-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.
@@ -76,6 +76,7 @@ public class SimpleThreadPoolTaskExecutor extends SimpleThreadPool
}
}
+ @Deprecated
@Override
public void execute(Runnable task, long startTimeout) {
execute(task);
diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java
index 0b976d3f00a..9c19aad5660 100644
--- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java
+++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-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.
@@ -147,6 +147,7 @@ public class ConcurrentTaskExecutor implements AsyncListenableTaskExecutor, Sche
this.adaptedExecutor.execute(task);
}
+ @Deprecated
@Override
public void execute(Runnable task, long startTimeout) {
this.adaptedExecutor.execute(task, startTimeout);
diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java
index 928814524c6..6a8334feebf 100644
--- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java
+++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2021 the original author or authors.
+ * Copyright 2002-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.
@@ -340,6 +340,7 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
}
}
+ @Deprecated
@Override
public void execute(Runnable task, long startTimeout) {
execute(task);
diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java
index 718c5833929..946f5bcc6f2 100644
--- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java
+++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2021 the original author or authors.
+ * Copyright 2002-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.
@@ -282,6 +282,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
}
}
+ @Deprecated
@Override
public void execute(Runnable task, long startTimeout) {
execute(task);
diff --git a/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java b/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java
index 12ddd769cd6..d4cf0324bca 100644
--- a/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java
+++ b/spring-core/src/main/java/org/springframework/core/task/AsyncTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-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.
@@ -21,8 +21,7 @@ import java.util.concurrent.Future;
/**
* Extended interface for asynchronous {@link TaskExecutor} implementations,
- * offering an overloaded {@link #execute(Runnable, long)} variant with a start
- * timeout parameter as well support for {@link java.util.concurrent.Callable}.
+ * offering support for {@link java.util.concurrent.Callable}.
*
*
Note: The {@link java.util.concurrent.Executors} class includes a set of
* methods that can convert some other common closure-like objects, for example,
@@ -41,10 +40,18 @@ import java.util.concurrent.Future;
*/
public interface AsyncTaskExecutor extends TaskExecutor {
- /** Constant that indicates immediate execution. */
+ /**
+ * Constant that indicates immediate execution.
+ * @deprecated as of 5.3.16 along with {@link #execute(Runnable, long)}
+ */
+ @Deprecated
long TIMEOUT_IMMEDIATE = 0;
- /** Constant that indicates no time limit. */
+ /**
+ * Constant that indicates no time limit.
+ * @deprecated as of 5.3.16 along with {@link #execute(Runnable, long)}
+ */
+ @Deprecated
long TIMEOUT_INDEFINITE = Long.MAX_VALUE;
@@ -58,7 +65,10 @@ public interface AsyncTaskExecutor extends TaskExecutor {
* @throws TaskTimeoutException in case of the task being rejected because
* of the timeout (i.e. it cannot be started in time)
* @throws TaskRejectedException if the given task was not accepted
+ * @see #execute(Runnable)
+ * @deprecated as of 5.3.16 since the common executors do not support start timeouts
*/
+ @Deprecated
void execute(Runnable task, long startTimeout);
/**
diff --git a/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java b/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
index 7d96032ad80..072502a868c 100644
--- a/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
+++ b/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-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.
@@ -174,6 +174,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
* if configured (through the superclass's settings).
* @see #doExecute(Runnable)
*/
+ @SuppressWarnings("deprecation")
@Override
public void execute(Runnable task) {
execute(task, TIMEOUT_INDEFINITE);
@@ -188,6 +189,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
* @see #TIMEOUT_IMMEDIATE
* @see #doExecute(Runnable)
*/
+ @Deprecated
@Override
public void execute(Runnable task, long startTimeout) {
Assert.notNull(task, "Runnable must not be null");
@@ -201,6 +203,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
}
}
+ @SuppressWarnings("deprecation")
@Override
public Future> submit(Runnable task) {
FutureTask