Class FutureHelper
- java.lang.Object
-
- com.google.appengine.api.datastore.FutureHelper
-
-
Constructor Summary
Constructors Constructor Description FutureHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TquietGet(Future<T> future)Return the result of the providedFuture, converting all checked exceptions to unchecked exceptions so the caller doesn't have to handle them.static <T,E extends Exception>
TquietGet(Future<T> future, Class<E> exceptionClass)Return the result of the providedFuture, converting all checked exceptions except those of the provided type to unchecked exceptions so the caller doesn't have to handle them.
-
-
-
Method Detail
-
quietGet
public static <T> T quietGet(Future<T> future)
Return the result of the providedFuture, converting all checked exceptions to unchecked exceptions so the caller doesn't have to handle them. If anExecutionExceptionis thrown the cause is wrapped in aRuntimeException. If anInterruptedExceptionis thrown it is wrapped in aDatastoreFailureException.- Type Parameters:
T- The type of the provided Future.- Parameters:
future- The Future whose result we want to return.- Returns:
- The result of the provided Future.
-
quietGet
public static <T,E extends Exception> T quietGet(Future<T> future, Class<E> exceptionClass) throws E extends Exception
Return the result of the providedFuture, converting all checked exceptions except those of the provided type to unchecked exceptions so the caller doesn't have to handle them. If anExecutionExceptionis thrown and the type of the cause does not equalexceptionClassthe cause is wrapped in aRuntimeException. If the type of the cause does equalexceptionClassthe cause itself is thrown. If anInterruptedExceptionis thrown it is wrapped in aDatastoreFailureException.- Type Parameters:
T- The type of the provided Future.- Parameters:
future- The Future whose result we want to return.exceptionClass- Exceptions of this type will be rethrown.- Returns:
- The result of the provided Future.
- Throws:
E- Thrown If an ExecutionException with a cause of the appropriate type is caught.E extends Exception
-
-