Propagate InterruptedException & TimeoutException

Previously we passed these exceptions to handler, which wrapped them
in a RuntimeException.  Instead propagate the actual cause so callers
can handle these properly.
This commit is contained in:
Andrew Gaul 2012-03-22 11:26:21 -07:00
parent ff0cc154d3
commit cc590fbffd
1 changed files with 6 additions and 0 deletions

View File

@ -58,6 +58,8 @@ public class ExceptionParsingListenableFuture<T> implements ListenableFuture<T>
public T get() throws InterruptedException, ExecutionException {
try {
return future.get();
} catch (InterruptedException ie) {
throw ie;
} catch (Exception e) {
return attemptConvert(e);
}
@ -72,6 +74,10 @@ public class ExceptionParsingListenableFuture<T> implements ListenableFuture<T>
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
try {
return future.get(timeout, unit);
} catch (InterruptedException ie) {
throw ie;
} catch (TimeoutException te) {
throw te;
} catch (Exception e) {
return attemptConvert(e);
}