7 Replies Latest reply on Jan 4, 2010 3:20 AM by Nikolay Elenkov

    back group threads without user interactions


      I have some back group threads to run when application starts up. These threads are moving from old code and are doing a lot of works without user interactions. So, I think there is no seam event here. How can I use seam context, especially entity manager?
        Thanks in advance!

      Below is my sample code.

      public class MyThread extends Thread {
           public void run() {
           //there is not seam context here. how can I use entity manager here ? 
                //do routine job .....
      public class BackgroupPool extends Thread {
           EntityManagerFactory entityManagerFactory;
           public EntityManagerFactory getEntityManagerFactory() {
                org.jboss.seam.contexts.Context applicationContext = (org.jboss.seam.contexts.Context) Contexts
                if (applicationContext != null) {
                     org.jboss.seam.persistence.EntityManagerFactory entityManagerFactory3 = (org.jboss.seam.persistence.EntityManagerFactory) applicationContext
                     if (entityManagerFactory3 != null) {
                          entityManagerFactory = entityManagerFactory3
           public void run() {
                for (int i = 0; i < 10; i++) {
                     MyThread thread = new MyThread();
           public void init() {