Deprecate AsyncTaskExecutor.execute(Runnable task, long startTimeout)
Closes gh-27959
This commit is contained in:
@@ -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}.
|
||||
*
|
||||
* <p>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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<Object> future = new FutureTask<>(task, null);
|
||||
@@ -208,6 +211,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
|
||||
return future;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
@@ -215,6 +219,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
|
||||
return future;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
|
||||
@@ -222,6 +227,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
|
||||
return future;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -25,7 +25,6 @@ import java.util.concurrent.RejectedExecutionException;
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0.1
|
||||
* @see TaskExecutor#execute(Runnable)
|
||||
* @see TaskTimeoutException
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TaskRejectedException extends RejectedExecutionException {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -23,8 +23,9 @@ package org.springframework.core.task;
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0.3
|
||||
* @see AsyncTaskExecutor#execute(Runnable, long)
|
||||
* @see TaskRejectedException
|
||||
* @deprecated as of 5.3.16 since the common executors do not support start timeouts
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("serial")
|
||||
public class TaskTimeoutException extends TaskRejectedException {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -97,6 +97,7 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void execute(Runnable task, long startTimeout) {
|
||||
execute(task);
|
||||
|
||||
Reference in New Issue
Block a user