Skip to content

Commit 8ac3ec5

Browse files
committed
Added missing @SInCE tags to DeferredResult
(cherry picked from commit 5d36ac0)
1 parent 472d79f commit 8ac3ec5

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,32 @@
2626
import org.springframework.web.context.request.NativeWebRequest;
2727

2828
/**
29-
* {@code DeferredResult} provides an alternative to using a {@link Callable}
30-
* for asynchronous request processing. While a {@code Callable} is executed
31-
* concurrently on behalf of the application, with a {@code DeferredResult} the
32-
* application can produce the result from a thread of its choice.
29+
* {@code DeferredResult} provides an alternative to using a {@link Callable} for
30+
* asynchronous request processing. While a {@code Callable} is executed concurrently
31+
* on behalf of the application, with a {@code DeferredResult} the application can
32+
* produce the result from a thread of its choice.
3333
*
34-
* <p>Subclasses can extend this class to easily associate additional data or
35-
* behavior with the {@link DeferredResult}. For example, one might want to
36-
* associate the user used to create the {@link DeferredResult} by extending the
37-
* class and adding an additional property for the user. In this way, the user
38-
* could easily be accessed later without the need to use a data structure to do
39-
* the mapping.
34+
* <p>Subclasses can extend this class to easily associate additional data or behavior
35+
* with the {@link DeferredResult}. For example, one might want to associate the user
36+
* used to create the {@link DeferredResult} by extending the class and adding an
37+
* additional property for the user. In this way, the user could easily be accessed
38+
* later without the need to use a data structure to do the mapping.
4039
*
41-
* <p>An example of associating additional behavior to this class might be
42-
* realized by extending the class to implement an additional interface. For
43-
* example, one might want to implement {@link Comparable} so that when the
44-
* {@link DeferredResult} is added to a {@link PriorityQueue} it is handled in
45-
* the correct order.
40+
* <p>An example of associating additional behavior to this class might be realized
41+
* by extending the class to implement an additional interface. For example, one
42+
* might want to implement {@link Comparable} so that when the {@link DeferredResult}
43+
* is added to a {@link PriorityQueue} it is handled in the correct order.
4644
*
4745
* @author Rossen Stoyanchev
4846
* @author Rob Winch
4947
* @since 3.2
5048
*/
5149
public class DeferredResult<T> {
5250

53-
private static final Log logger = LogFactory.getLog(DeferredResult.class);
54-
5551
private static final Object RESULT_NONE = new Object();
5652

53+
private static final Log logger = LogFactory.getLog(DeferredResult.class);
54+
5755

5856
private final Long timeout;
5957

@@ -91,7 +89,7 @@ public DeferredResult(Long timeout) {
9189
/**
9290
* Create a DeferredResult with a timeout value and a default result to use
9391
* in case of timeout.
94-
* @param timeout timeout value in milliseconds; ignored if {@code null}
92+
* @param timeout timeout value in milliseconds (ignored if {@code null})
9593
* @param timeoutResult the result to use
9694
*/
9795
public DeferredResult(Long timeout, Object timeoutResult) {
@@ -114,6 +112,7 @@ public final boolean isSetOrExpired() {
114112

115113
/**
116114
* Return {@code true} if the DeferredResult has been set.
115+
* @since 4.0
117116
*/
118117
public boolean hasResult() {
119118
return (this.result != RESULT_NONE);
@@ -123,6 +122,7 @@ public boolean hasResult() {
123122
* Return the result, or {@code null} if the result wasn't set. Since the result
124123
* can also be {@code null}, it is recommended to use {@link #hasResult()} first
125124
* to check if there is a result prior to calling this method.
125+
* @since 4.0
126126
*/
127127
public Object getResult() {
128128
Object resultToCheck = this.result;
@@ -137,22 +137,21 @@ final Long getTimeoutValue() {
137137
}
138138

139139
/**
140-
* Register code to invoke when the async request times out. This method is
141-
* called from a container thread when an async request times out before the
142-
* {@code DeferredResult} has been set. It may invoke
143-
* {@link DeferredResult#setResult(Object) setResult} or
144-
* {@link DeferredResult#setErrorResult(Object) setErrorResult} to resume
145-
* processing.
140+
* Register code to invoke when the async request times out.
141+
* <p>This method is called from a container thread when an async request
142+
* times out before the {@code DeferredResult} has been populated.
143+
* It may invoke {@link DeferredResult#setResult setResult} or
144+
* {@link DeferredResult#setErrorResult setErrorResult} to resume processing.
146145
*/
147146
public void onTimeout(Runnable callback) {
148147
this.timeoutCallback = callback;
149148
}
150149

151150
/**
152-
* Register code to invoke when the async request completes. This method is
153-
* called from a container thread when an async request completed for any
154-
* reason including timeout and network error. This method is useful for
155-
* detecting that a {@code DeferredResult} instance is no longer usable.
151+
* Register code to invoke when the async request completes.
152+
* <p>This method is called from a container thread when an async request
153+
* completed for any reason including timeout and network error. This is useful
154+
* for detecting that a {@code DeferredResult} instance is no longer usable.
156155
*/
157156
public void onCompletion(Runnable callback) {
158157
this.completionCallback = callback;
@@ -181,8 +180,8 @@ public final void setResultHandler(DeferredResultHandler resultHandler) {
181180
/**
182181
* Set the value for the DeferredResult and handle it.
183182
* @param result the value to set
184-
* @return "true" if the result was set and passed on for handling; "false"
185-
* if the result was already set or the async request expired.
183+
* @return "true" if the result was set and passed on for handling;
184+
* "false" if the result was already set or the async request expired
186185
* @see #isSetOrExpired()
187186
*/
188187
public boolean setResult(T result) {
@@ -203,13 +202,12 @@ private boolean setResultInternal(Object result) {
203202
}
204203

205204
/**
206-
* Set an error value for the {@link DeferredResult} and handle it. The value
207-
* may be an {@link Exception} or {@link Throwable} in which case it will be
208-
* processed as if a handler raised the exception.
205+
* Set an error value for the {@link DeferredResult} and handle it.
206+
* The value may be an {@link Exception} or {@link Throwable} in which case
207+
* it will be processed as if a handler raised the exception.
209208
* @param result the error result value
210209
* @return "true" if the result was set to the error value and passed on for
211-
* handling; "false" if the result was already set or the async request
212-
* expired.
210+
* handling; "false" if the result was already set or the async request expired
213211
* @see #isSetOrExpired()
214212
*/
215213
public boolean setErrorResult(Object result) {

0 commit comments

Comments
 (0)