V
- The type returned by the wrapped callable.public interface Attempt<V>
Modifier and Type | Method and Description |
---|---|
V |
get()
Returns the result of the attempt, if any.
|
java.lang.Throwable |
getExceptionCause()
Gets the exception thrown by the call
|
V |
getResult()
Gets the result of the call
|
boolean |
hasException()
Tells if the call threw an exception or not
|
boolean |
hasResult()
Tells if the call returned a result or not
|
V get() throws java.util.concurrent.ExecutionException
java.util.concurrent.ExecutionException
- if an exception was thrown by the attempt. The thrown
exception is set as the cause of the ExecutionExceptionboolean hasResult()
true
if the call returned a result, false
if it threw an exceptionboolean hasException()
true
if the call threw an exception, false
if it returned a resultV getResult() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the call didn't return a result, but threw an exception,
as indicated by hasResult()
java.lang.Throwable getExceptionCause() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the call didn't throw an exception,
as indicated by hasException()