Class ListenableFutureReturnValueHandler
java.lang.Object
org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler
org.springframework.messaging.handler.invocation.ListenableFutureReturnValueHandler
- All Implemented Interfaces:
AsyncHandlerMethodReturnValueHandler,HandlerMethodReturnValueHandler
Support for
ListenableFuture as a return value type.- Since:
- 4.2
- Author:
- Sebastien Deleuze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleansupportsReturnType(MethodParameter returnType) Whether the given method return type is supported by this handler.toListenableFuture(Object returnValue, MethodParameter returnType) Adapt the asynchronous return value to aListenableFuture.Methods inherited from class org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler
handleReturnValue, isAsyncReturnValue
-
Constructor Details
-
ListenableFutureReturnValueHandler
public ListenableFutureReturnValueHandler()
-
-
Method Details
-
supportsReturnType
Description copied from interface:HandlerMethodReturnValueHandlerWhether the given method return type is supported by this handler.- Parameters:
returnType- the method return type to check- Returns:
trueif this handler supports the supplied return type;falseotherwise
-
toListenableFuture
Description copied from interface:AsyncHandlerMethodReturnValueHandlerAdapt the asynchronous return value to aListenableFuture. Implementations should consider returning an instance ofSettableListenableFuture. Return value handling will then continue when the ListenableFuture is completed with either success or error.Note: this method will only be invoked after
HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)is called and it returnstrue.- Parameters:
returnValue- the value returned from the handler methodreturnType- the type of the return value- Returns:
- the resulting ListenableFuture, or
nullin which case no further handling will be performed
-