title: SWF: End workflow based on Promise
body: <p>I have a decider that calls an activity. The activity returns a list of validation errors. If the decider receives that list and it's not empty, I want to exit out of the workflow.</p>
  
  <p>To exit the workflow I can just return in the decider, and it exits the workflow. The problem is that I'm not able to get the result from the activity. I'd have expected this to work, but it doesn't.. violations.isReady() always returns false:</p>
  
  <pre><code>public class WorkflowImpl implements Workflow {
      ActivitiesClient activities;
  
      public Workflow(/*...*/) {
          // ...
      }
  
      @Override
      public void do(WorkflowInput input) {
          Promise&lt;List&lt;String&gt;&gt; violations = activities.validate(input);
  
          if (!violations.isReady()) { // "do()" will be called when violations is ready.. right?
              return;
          } else if (!CollectionUtils.isEmpty(violations.get())) {
              return; // or throw ValidationException
          }
  
          // do other stuff
      }
  }
  </code></pre>
  
  <p>I don't want to do the alternative which is to poll for violations.isReady() to be true, because this will tie up the decider thread for who knows how long. I'm not even sure if that would work.</p>
  
  <p>Help?</p>