Add getResult/hasResult methods to DeferredResult
Issue: SPR-10603
This commit is contained in:
@@ -107,6 +107,22 @@ public class DeferredResult<T> {
|
||||
return ((this.result != RESULT_NONE) || this.expired);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the DeferredResult has been set.
|
||||
*/
|
||||
public boolean hasResult() {
|
||||
return this.result != RESULT_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the result or {@code null} if the result wasn't set; since the result can
|
||||
* also be {@code null}, it is recommended to use {@link #hasResult()} first
|
||||
* to check if there is a result prior to calling this method.
|
||||
*/
|
||||
public Object getResult() {
|
||||
return hasResult() ? this.result : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the configured timeout value in milliseconds.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user