in src/main/java/com/amazonaws/services/simpleworkflow/flow/interceptors/ScheduleDecorator.java [47:88]
public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
try {
if (!isDecorated(method, args)) {
return method.invoke(object, args);
}
}
catch (InvocationTargetException ite) {
throw ite.getTargetException();
}
Class<?> returnType = method.getReturnType();
boolean isVoidReturnType = Void.TYPE.equals(returnType);
final Settable<Object> result = isVoidReturnType ? null : new Settable<Object>();
new TryFinally() {
Object r;
@Override
protected void doTry() throws Throwable {
scheduledExecutor.execute(new AsyncRunnable() {
@Override
public void run() throws Throwable {
try {
r = method.invoke(object, args);
}
catch (InvocationTargetException ite) {
throw ite.getTargetException();
}
}
});
}
@Override
protected void doFinally() throws Throwable {
if (result != null) {
result.set(r);
}
}
};
return result;
}