0 Replies Latest reply on May 19, 2008 4:09 AM by Swati Biwal

    multi-threading inside JBoss Portlet

    Swati Biwal Newbie

      Hi,

      I have the following situation -
      * User takes an action on a portlet and the portlet starts a new thread which handles the action (apparently the action which is copying some files may take long and thats why I fork it in a new thread).
      * If in the meantime, the user starts the (copy) action again, the previous thread should be interrupted and the new copy should be honored.

      All of this works fine as long as I do not refresh the view of my portlet ie the isInterrupted flag is set on any previous thread and when this thread checks for "isInterrupted()", it finds itself interrupted and I can exit gracefully. But if I have a situation where the user interrupts a previous copy action (lets say Thread1), and then refreshes the portlet (anything that called doView), then the isInterrupted flag on Thread1 is cleared and it still proceeds.

      Does doView of a portlet causes thread interrupts to be cleared ? Am I doing something wrong ? I had searched the forums enough, but did not find anyone doing something similar to this.

      Any help would be appreciated.