public void execute()

in src/main/java/com/amazonaws/services/simpleworkflow/flow/interceptors/AsyncCancelAndRetryExecutor.java [46:81]


    public void execute(final AsyncRunnable cmd) {
        if (currentCommandTryCatchFinally != null) {
            throw new IllegalStateException("Already executing a command");
        }
        command = cmd;
        currentCommandTryCatchFinally = new TryCatchFinally() {

            @Override
            protected void doTry() throws Throwable {
                cmd.run();
            }

            @Override
            protected void doCatch(Throwable e) throws Throwable {
                if (e instanceof CancellationException && commandDone != null) {
                    cancelledDueToRetryRequest = true;
                }
                else {
                    throw e;
                }
            }

            @Override
            protected void doFinally() throws Throwable {
                if (!cancelledDueToRetryRequest) {
                    command = null;
                }
                if (commandDone != null) {
                    commandDone.set(null);
                }
                commandDone = null;
                currentCommandTryCatchFinally = null;
            }

        };
    }