1 Reply Latest reply on Oct 4, 2012 6:24 PM by 722711

    How to kill a thread that was created in bean ?

      i want to print some text - using thread ( to avoid blocking the application untill it's printing ) which was created within a bean which is a part of EPN.
      So, I create a thread within that bean but, when I want to update my app ( deploy ), I saw that the thread ( which was created already )
      is still running.

      Since i don't know when the bean is destroyed ( because it's part of the EPN ) , there is no way to know when to interrupt the thread and thus killing it .
      The only thing i know is that it should be killed when I publish ( deploy) the application.
      Is there a way to do that ?
        • 1. Re: How to kill a thread that was created in bean ?
          We don't encourage creating threads in the beans for this reason. You should be using RunnableBean or work managers for this.

          However, you can implement com.bea.wlevs.ede.api.DisposableBean, whose destroy method will be called when the stage is destroyed. That is the place to release any resources.
          1 person found this helpful