0 Replies Latest reply on Nov 11, 2008 1:10 PM by andreas_back

    Does a progressBar need an own thread for the action?

    andreas_back Novice

      Hello,

      within the thread

      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=133216&postdays=0&postorder=asc&start=10

      the question is discussed if an own thread is needed to start a lengthly operation when a progress bar is used.

      In the demo the method startProcess

      <a4j:commandButton action="#{progressBarBean.startProcess}"


      does call

      public String startProcess() {
       setEnabled(true);
       setButtonRendered(false);
       setStartTime(new Date().getTime());
       return null;
       }
      


      and immediately returns and issues a rerendering of the
      progressPanel that contains the progressBar

      reRender="progressPanel"


      and therefore the progressBar can be seen.

      The system time for sure is incremented independently of the execution of the startProcess method, so it is not an own thread, but it logically seems to serve as an own thread.

      We have a potentially lengthly operation (that may take several minutes).
      It is easy to start it in an own thread while the action method of the
      button is executed, so that this method returns quickly and provokes a
      rendering of the panel, and this works well.

      But can this really be archieved without starting the operation in a new thread?

      And would it not be great to enhance the demo example by the starting of a thread so that is it easier to adopt?

      Greetings

      Andreas