JIRA-1138
closes #37
diff --git a/giraph-core/src/main/java/org/apache/giraph/utils/ProgressableUtils.java b/giraph-core/src/main/java/org/apache/giraph/utils/ProgressableUtils.java
index 88bb944..d4dfb8e 100644
--- a/giraph-core/src/main/java/org/apache/giraph/utils/ProgressableUtils.java
+++ b/giraph-core/src/main/java/org/apache/giraph/utils/ProgressableUtils.java
@@ -270,8 +270,16 @@
// Try to get result from the future
result = entry.getValue().get(
MSEC_TO_WAIT_ON_EACH_FUTURE, TimeUnit.MILLISECONDS);
- } catch (InterruptedException | ExecutionException e) {
- throw new IllegalStateException("Exception occurred", e);
+ } catch (InterruptedException e) {
+ throw new IllegalStateException("Interrupted", e);
+ } catch (ExecutionException e) {
+ // Execution exception wraps the actual cause
+ if (e.getCause() instanceof RuntimeException) {
+ throw (RuntimeException) e.getCause();
+ } else {
+ throw new IllegalStateException("Exception occurred", e.getCause());
+ }
+
} catch (TimeoutException e) {
// If result is not ready yet just keep waiting
continue;