title: Making a Java MVC application wait to refresh a web screen
body: <p>I'm working on a Java Spring-MVC application that needs to refresh its screen upon completion of certain actions performed by a Java Web Start application that it kicks off. In a utility method called by the one that refreshes the screen, I create a thread to run a query to see if the action of the JWS app has completed, and if not, it goes to sleep for a few seconds then checks again. (After <em>x</em> number of tries, the thread breaks out of the loop.)</p>
  
  <p>So my thread code is functioning the way I want it to, and will correctly catch when the action is complete, but the problem is that the method has moved on, so the screen refresh might happen before the status of the file in question has been updated. What should I be doing here: is there a way to make the refresh-screen method wait till the status-checker thread has completed, or should my thread be calling a method to refresh the screen? </p>