title: Long Running Task in Java EE WebApp + icefaces
body: <p>I don't have much knowledge on Java EE but am currently learning it.</p>
  
  <p>I've come up with a project which involves a long running task (up to several minutes) invoked by the user. The task consists of several steps. Of course I would like to show the progress to the user.</p>
  
  <p>The project uses Java EE with JPA, JSF and Icefaces. It runs on Glassfish.</p>
  
  <p>An experienced colleague adviced the following pattern to me:</p>
  
  <ol>
  <li>Create a stateless, asynchronous EJB which creates a response object and processes the request</li>
  <li>Persist the response object after each step</li>
  <li>In the backing bean, query and display the response object</li>
  </ol>
  
  <p>This works well. My only problem is to update the status site to mirror the progress. Currently I am doing this with a simple JavaScript page reload every x seconds.</p>
  
  <p>Do you know a way/pattern to reflect the current step from the stateless ejb to the jsf backing bean?
  Or, and I would prefer that, do you know a way to query the value of a backing bean every x seconds?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I am aware of the Icefaces push mechanism, but I want the status update site to be decoupled from the calculation EJB for the following reasons:</p>
  
  <ul>
  <li>The backing bean might already be destroyed because the user left the site and return later to fetch the result</li>
  <li>Multiple sessions and therefore multiple beans may exist for one user</li>
  <li>Having a clean design</li>
  </ul>