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 committed by Adrian Cole
parent 5e36573ff9
commit d5e66575e9
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 { public T get() throws InterruptedException, ExecutionException {
try { try {
return future.get(); return future.get();
} catch (InterruptedException ie) {
throw ie;
} catch (Exception e) { } catch (Exception e) {
return attemptConvert(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 { public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
try { try {
return future.get(timeout, unit); return future.get(timeout, unit);
} catch (InterruptedException ie) {
throw ie;
} catch (TimeoutException te) {
throw te;
} catch (Exception e) { } catch (Exception e) {
return attemptConvert(e); return attemptConvert(e);
} }