Forum Stats

  • 3,855,268 Users
  • 2,264,494 Discussions


How to kill a thread that was created in bean ?

938644 Member Posts: 50
edited Oct 4, 2012 2:24PM in Complex Event Processing
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 ?


  • 722711
    722711 Member Posts: 91
    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.
This discussion has been closed.