1 Reply Latest reply on Apr 17, 2009 10:15 AM by handsomeli

    Asynchronous thread problem

      I meet a thread problem:
      I have a data processing management page.When user press the button, one data process begins.
      The process takes more than 10 minutes,but when it runs for about 5 minutes, an exception throws:

      2009-04-16 15:41:39,928 INFO [org.jboss.seam.async.QuartzDispatcher] In the scheduleInvocation()
      2009-04-16 15:41:39,928 INFO [org.jboss.seam.async.QuartzDispatcher] In the scheduleWithQuartzService()
      2009-04-16 15:41:39,932 INFO [org.jboss.seam.async.QuartzDispatcher] End executing Quartz job
      2009-04-16 15:41:39,940 INFO [org.jboss.seam.async.QuartzDispatcher] Start executing Quartz job
      ...
      DOING THE DATA PROCESSING
      .....
      
      2009-04-16 15:47:40,099 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id
      
      7f000001:8977:49e6d1af:13c invoked while multiple threads active within it.
      2009-04-16 15:47:40,099 WARN [com.arjuna.ats.arjuna.logging.arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check -
      
      atomic action 7f000001:8977:49e6d1af:13c aborting with 1 threads active!
      
      18:11:30,132 ERROR [TxPolicy] IllegalStateException while setting transaction for rollback only
      java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive]
      
      The transaction is not active!
       at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.setRollbackOnly(TransactionImple.java:344)
      
      


      These are my code segments,from the html to java:
      1.
      <h:commandButton action="#{permeabilitystatList.permeabilityWeekCollect}" value="OK"/>
      


      2. PermeabilityStatListBean
      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("permeabilitystatList")
      public class PermeabilityStatListBean implements PermeabilityStatList {
       @In(required=false)
       PermeabilityWeekCollect permeabilityWeekCollectThread;
      ....
       public void permeabilityWeekCollect()
       {
      ....
       permeabilityWeekCollectThread.permeabilityWeekCollect("",branchObject, weekscope); //RUN IN A THREAD
       ....
       }
      

      3.
      @Stateless
      @Name("permeabilityWeekCollectThread")
      @AutoCreate
      public class PermeabilityWeekCollectThread implements PermeabilityWeekCollect{
       @PersistenceContext EntityManager em;
      ....
       @Asynchronous
       public void permeabilityWeekCollect(String centerName,Branch branch, String weekscope){
      ...
       // RUN FOR MORE THAN 10 MINUTES!!
       em.persist(....);
       em.flush();
       em.clear();
       }
      }
      

      According to the exception information, I think it is the closing state of permeabilitystatList which is the parent thread of permeabilityWeekCollectThread that make permeabilityWeekCollectThread lose context.
      What should I do ??
      Thank you very much!!!

        • 1. problem solved

          I read other topics in the forum and find the solution:
          modify the value of TransactionTimeout of jboss:service=TransactionManage in the file jboss-service.xml in jboss .
          The default value is 300, which is not long enough for my thread to run.