diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java b/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java index 5bf9f578fda..28314f5620d 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java @@ -26,23 +26,21 @@ import org.springframework.util.Assert; import org.springframework.web.context.request.NativeWebRequest; /** - * {@code DeferredResult} provides an alternative to using a {@link Callable} - * for asynchronous request processing. While a {@code Callable} is executed - * concurrently on behalf of the application, with a {@code DeferredResult} the - * application can produce the result from a thread of its choice. + * {@code DeferredResult} provides an alternative to using a {@link Callable} for + * asynchronous request processing. While a {@code Callable} is executed concurrently + * on behalf of the application, with a {@code DeferredResult} the application can + * produce the result from a thread of its choice. * - *
Subclasses can extend this class to easily associate additional data or - * behavior with the {@link DeferredResult}. For example, one might want to - * associate the user used to create the {@link DeferredResult} by extending the - * class and adding an additional property for the user. In this way, the user - * could easily be accessed later without the need to use a data structure to do - * the mapping. + *
Subclasses can extend this class to easily associate additional data or behavior + * with the {@link DeferredResult}. For example, one might want to associate the user + * used to create the {@link DeferredResult} by extending the class and adding an + * additional property for the user. In this way, the user could easily be accessed + * later without the need to use a data structure to do the mapping. * - *
An example of associating additional behavior to this class might be - * realized by extending the class to implement an additional interface. For - * example, one might want to implement {@link Comparable} so that when the - * {@link DeferredResult} is added to a {@link PriorityQueue} it is handled in - * the correct order. + *
An example of associating additional behavior to this class might be realized
+ * by extending the class to implement an additional interface. For example, one
+ * might want to implement {@link Comparable} so that when the {@link DeferredResult}
+ * is added to a {@link PriorityQueue} it is handled in the correct order.
*
* @author Rossen Stoyanchev
* @author Rob Winch
@@ -50,10 +48,10 @@ import org.springframework.web.context.request.NativeWebRequest;
*/
public class DeferredResult This method is called from a container thread when an async request
+ * times out before the {@code DeferredResult} has been populated.
+ * It may invoke {@link DeferredResult#setResult setResult} or
+ * {@link DeferredResult#setErrorResult setErrorResult} to resume processing.
*/
public void onTimeout(Runnable callback) {
this.timeoutCallback = callback;
}
/**
- * Register code to invoke when the async request completes. This method is
- * called from a container thread when an async request completed for any
- * reason including timeout and network error. This method is useful for
- * detecting that a {@code DeferredResult} instance is no longer usable.
+ * Register code to invoke when the async request completes.
+ * This method is called from a container thread when an async request
+ * completed for any reason including timeout and network error. This is useful
+ * for detecting that a {@code DeferredResult} instance is no longer usable.
*/
public void onCompletion(Runnable callback) {
this.completionCallback = callback;
@@ -178,8 +177,8 @@ public class DeferredResult