0 Replies Latest reply on Jan 29, 2013 5:56 PM by trungsi

    Seam and multi threading

    trungsi

      Hello,

       

      Currently, I have to do perfermance optimization of one of our Seam applications. And we have a functionality which clones thousands of objects. So I thought of using multi-threading to speed it up and then aggregate the result at the end. The problem is that I didn't find any documentation on how to spawn threads within Seam app with all seam stuffs (Denpendency Injection, Context Initialization,...) properly setup .

       

      But I've found a thread on StackOverflow : http://stackoverflow.com/questions/12735815/why-cant-i-inject-dependencies-with-in-using-jboss-seam-in-a-new-thread-from in which it was briefly advised the use of LifeCycle api to get dependency injection in created threads. So I did some tests and it seems to work in my case.

       

      I'd like to know if it's the correct way to get dependency injection when we use threads in Seam apps? Or is there a proper way to do this?

       

      I know Seam is closely integrated to EJB model which does not allow thread. So if it's not recommended to directly create threads in Seam apps, is there any support for this kind of scenario?

       

      FI, we use Seam 2.2.0.

       

      Thanks for your help.

      Trung