mirror of https://github.com/apache/jclouds.git
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:
parent
5e36573ff9
commit
d5e66575e9
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue