in src/main/java/com/amazonaws/services/simpleworkflow/flow/core/TryCatchFinallyContext.java [149:201]
public void run() {
if (state == State.CLOSED) {
return;
}
if (state == State.CREATED) {
state = State.TRYING;
}
setCurrent(this);
Throwable f = failure;
Error error = null;
try {
switch (state) {
case TRYING:
if (cancelRequested) {
return;
}
tryCatchFinally.doTry();
break;
case CATCHING:
failure = null;
// Need to reset cancelRequested to allow addition of new child tasks
cancelRequested = false;
tryCatchFinally.doCatch(f);
break;
case FINALIZING:
// Need to reset cancelRequested to allow addition of new child tasks
cancelRequested = false;
tryCatchFinally.doFinally();
}
}
catch (Throwable e) {
if (e instanceof Error) {
error = (Error) e;
}
else {
if (stackTrace != null && e != f) {
AsyncStackTrace merged = new AsyncStackTrace(stackTrace, e.getStackTrace(), 0);
merged.setStartFrom(getParentTaskMethodName());
e.setStackTrace(merged.getStackTrace());
}
failure = e;
cancelHeirs();
}
}
finally {
if (error != null) {
throw error;
}
setCurrent(null);
executed = true;
updateState();
}
}