Mark ListenableFuture as deprecated for removal
Closes gh-33808
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -67,10 +67,12 @@ public interface AsyncHandlerMethodReturnValueHandler extends HandlerMethodRetur
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link #toCompletableFuture(Object, MethodParameter)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
@Nullable
|
||||
default org.springframework.util.concurrent.ListenableFuture<?> toListenableFuture(
|
||||
Object returnValue, MethodParameter returnType) {
|
||||
|
||||
CompletableFuture<?> result = toCompletableFuture(returnValue, returnType);
|
||||
return (result != null ?
|
||||
new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(result) :
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.messaging.handler.invocation;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Support for {@link ListenableFuture} as a return value type.
|
||||
@@ -28,22 +27,23 @@ import org.springframework.util.concurrent.ListenableFuture;
|
||||
* @since 4.2
|
||||
* @deprecated as of 6.0, in favor of {@link CompletableFutureReturnValueHandler}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class ListenableFutureReturnValueHandler extends AbstractAsyncReturnValueHandler {
|
||||
|
||||
@Override
|
||||
public boolean supportsReturnType(MethodParameter returnType) {
|
||||
return ListenableFuture.class.isAssignableFrom(returnType.getParameterType());
|
||||
return org.springframework.util.concurrent.ListenableFuture.class.isAssignableFrom(returnType.getParameterType());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ListenableFuture<?> toListenableFuture(Object returnValue, MethodParameter returnType) {
|
||||
return (ListenableFuture<?>) returnValue;
|
||||
public org.springframework.util.concurrent.ListenableFuture<?> toListenableFuture(Object returnValue, MethodParameter returnType) {
|
||||
return (org.springframework.util.concurrent.ListenableFuture<?>) returnValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<?> toCompletableFuture(Object returnValue, MethodParameter returnType) {
|
||||
return ((ListenableFuture<?>) returnValue).completable();
|
||||
return ((org.springframework.util.concurrent.ListenableFuture<?>) returnValue).completable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers() {
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -35,7 +35,8 @@ public interface ConnectionHandlingStompSession extends StompSession, StompTcpCo
|
||||
* Return a future that will complete when the session is ready for use.
|
||||
* @deprecated as of 6.0, in favor of {@link #getSession()}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
default org.springframework.util.concurrent.ListenableFuture<StompSession> getSessionFuture() {
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(
|
||||
getSession());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -96,9 +96,11 @@ public class ReactorNettyTcpStompClient extends StompClientSupport {
|
||||
* @return a ListenableFuture for access to the session when ready for use
|
||||
* @deprecated as of 6.0, in favor of {@link #connectAsync(StompSessionHandler)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public org.springframework.util.concurrent.ListenableFuture<StompSession> connect(
|
||||
StompSessionHandler handler) {
|
||||
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(
|
||||
connectAsync(handler));
|
||||
}
|
||||
@@ -122,9 +124,11 @@ public class ReactorNettyTcpStompClient extends StompClientSupport {
|
||||
* @return a ListenableFuture for access to the session when ready for use
|
||||
* @deprecated as of 6.0, in favor of {@link #connectAsync(StompHeaders, StompSessionHandler)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public org.springframework.util.concurrent.ListenableFuture<StompSession> connect(
|
||||
@Nullable StompHeaders connectHeaders, StompSessionHandler handler) {
|
||||
|
||||
ConnectionHandlingStompSession session = createSession(connectHeaders, handler);
|
||||
this.tcpClient.connectAsync(session);
|
||||
return session.getSessionFuture();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -37,7 +37,8 @@ public interface TcpConnection<P> extends Closeable {
|
||||
* message was successfully sent
|
||||
* @deprecated as of 6.0, in favor of {@link #sendAsync(Message)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
default org.springframework.util.concurrent.ListenableFuture<Void> send(Message<P> message) {
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(
|
||||
sendAsync(message));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -34,9 +34,11 @@ public interface TcpOperations<P> {
|
||||
* connection is successfully established
|
||||
* @deprecated as of 6.0, in favor of {@link #connectAsync(TcpConnectionHandler)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
default org.springframework.util.concurrent.ListenableFuture<Void> connect(
|
||||
TcpConnectionHandler<P> connectionHandler) {
|
||||
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(
|
||||
connectAsync(connectionHandler));
|
||||
}
|
||||
@@ -58,9 +60,11 @@ public interface TcpOperations<P> {
|
||||
* initial connection is successfully established
|
||||
* @deprecated as of 6.0, in favor of {@link #connectAsync(TcpConnectionHandler, ReconnectStrategy)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
default org.springframework.util.concurrent.ListenableFuture<Void> connect(
|
||||
TcpConnectionHandler<P> connectionHandler, ReconnectStrategy reconnectStrategy) {
|
||||
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(
|
||||
connectAsync(connectionHandler, reconnectStrategy));
|
||||
}
|
||||
@@ -81,10 +85,10 @@ public interface TcpOperations<P> {
|
||||
* connection is successfully closed
|
||||
* @deprecated as of 6.0, in favor of {@link #shutdownAsync()}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
default org.springframework.util.concurrent.ListenableFuture<Void> shutdown() {
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(
|
||||
shutdownAsync());
|
||||
return new org.springframework.util.concurrent.CompletableToListenableFutureAdapter<>(shutdownAsync());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -571,7 +571,7 @@ public class SimpAnnotationMethodMessageHandlerTests {
|
||||
|
||||
@Controller
|
||||
@MessageMapping("listenable-future")
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
private static class ListenableFutureController {
|
||||
|
||||
org.springframework.util.concurrent.ListenableFutureTask<String> future;
|
||||
|
||||
Reference in New Issue
Block a user