3 Replies Latest reply on Oct 18, 2010 7:19 AM by Assem Bardi

    How to Run a long Period thread that use entityManager  without loosing transaction or how to not use tranction and obtain db access from it

    Assem Bardi Newbie

      Hi all,
      i have to run a thread for a long period :

      public class TaskBulkAds {
           EntityManager entityManager;
           public void MyThread(Campaign campaign) {
                log.info("Processing Campaign : " + campaign.getName());
                String QueryCampaign = "select profile.msisdn from Profile profile";
                Query query2 = entityManager.createQuery(QueryCampaign);
               ....while(condition) //this while will loop for a long time using entitymanager
                        //here i use entityManager

      after a long period of running : i got a transaction error :

      15:18:53,107 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX 7f000101:c66d:4cb851ab:ac in state  RUN
      15:18:53,110 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id 7f000101:c66d:4cb851ab:ac invoked while multiple threads active within it.
      15:18:53,110 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action 7f000101:c66d:4cb851ab:ac aborting with 1 threads active!
      15:18:53,111 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_7] - TransactionReaper::doCancellations worker Thread[Thread-10,5,jboss] successfully canceled TX 7f000101:c66d:4cb851ab:ac
      15:18:53,170 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_40] - Abort called on already aborted atomic action 7f000101:c66d:4cb851ab:ac
      15:18:53,173 ERROR [AsynchronousExceptionHandler] Exeception thrown whilst executing asynchronous call

      please how to get acess to db without using transactions at all from that thread (MyThread method).