5 Replies Latest reply on Sep 23, 2011 12:48 AM by Jason Porter

    Seam 3 Cron module on AS7

    zeeman Novice

      I have tried using both @Asynchronous annotations from EJB and Cron, neither runs in a different thread. I have a simple method with a void return type which I call after the serverlet is initialed.


      I'm using jboss AS7 with Seam 3.1.0.Beta2 for all modules. Except for Cron module only release available is Alpha1.


      Serverlet listener (defined in web.xml)




      public class ServletLoaderListner implements ServletContextListener {
      
           @Inject
           private DBLoader dbLoader;
      
           @Inject
           private Logger log;
      
           @Override
           public void contextDestroyed(ServletContextEvent arg0) {
      
           }
      
           @Override
           public void contextInitialized(ServletContextEvent arg0) {
                log.warn("ThreadID before calling asyncmethod: " + Thread.currentThread().getId());
                dbLoader.setup();
           }
      }




      DBLoader is below:




      @Stateless
      public class DBLoader implements Serializable {
           private static final long serialVersionUID = 1L;
           public static short MEMBERS_TO_LOAD = 4;
           @PersistenceContext
           private EntityManager entityManager;
      
           @Inject
           private Logger logger;
              @Asynchronous
           public void setup() {
                logger.warn("DBLoader ThreadID: " + Thread.currentThread().getId());
              }
      }