You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by GitBox <gi...@apache.org> on 2020/07/22 21:22:11 UTC

[GitHub] [tomee] cocorossello commented on pull request #693: Owb2.0.17

cocorossello commented on pull request #693:
URL: https://github.com/apache/tomee/pull/693#issuecomment-662703666


   Hi, there is something I don't understand. 
   
   Looking at the SchedulerTest:
   
   It works in OWB 2.0.12 and it doesn't in 2.0.16 or 17.
   
   The stacktrace (2.0.16) is:
   
   	at org.apache.webbeans.ee.event.TransactionalEventNotifier.registerTransactionSynchronization(TransactionalEventNotifier.java:106)
   	at org.apache.openejb.cdi.OpenEJBTransactionService.registerTransactionSynchronization(OpenEJBTransactionService.java:94)
   	at org.apache.webbeans.event.NotificationManager.doFireSync(NotificationManager.java:726)
   	at org.apache.webbeans.event.NotificationManager.doFireEvent(NotificationManager.java:662)
   	at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:646)
   	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:495)
   	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:469)
   	at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:453)
   	at org.apache.webbeans.container.InjectableBeanManager.fireEvent(InjectableBeanManager.java:109)
   	at org.superbiz.schedule.events.Scheduler.timeout(Scheduler.java:54)
   
   
   In 2.0.12 version is calling 
   
                           invokeObserverMethod(event, metadata, observer);
   
   and in 2.0.16 is going for
                           transactionService.registerTransactionSynchronization(phase, observer, event);
   
   So it has to do something with this commit:
   
   https://github.com/apache/openwebbeans/commit/50a97460d3e824f298c52f98195a7d7ea5ac52af#diff-861b38d68e2a8d4b2ea08ab08d7ac29e
   
   This is 2.0.12:
   
                   if(phase != null && phase != TransactionPhase.IN_PROGRESS)
                   {
                       if (async)
                       {
                           throw new WebBeansConfigurationException("Async Observer Methods can only use TransactionPhase.IN_PROGRESS!");
                       }
   
                       TransactionService transactionService = webBeansContext.getService(TransactionService.class);
                       if(transactionService != null)
                       {
                           transactionService.registerTransactionSynchronization(phase, observer, event);
                       }
                       else
                       {
                           invokeObserverMethod(event, metadata, observer);
                       }                    
                   }
                   else
                   {
                       if (async)
                       {
                           completableFutures.add(invokeObserverMethodAsync(event, metadata, observer, notificationOptions));
                       }
                       else
                       {
                           invokeObserverMethod(event, metadata, observer);
                       }
                   }
   
   (so when phase is IN_PROGRESS it won't try to get the TransactionService)
   
   
   and this is 2.0.16:
   
   
                   if (phase == null || phase != TransactionPhase.IN_PROGRESS)
                   {
                       invokeObserverMethod(context, observer);
                   }
                   else
                   {
                       TransactionService transactionService = webBeansContext.getTransactionService();
                       if(transactionService != null)
                       {
                           transactionService.registerTransactionSynchronization(phase, observer, context.getEvent());
                       }
                       else
                       {
                           invokeObserverMethod(context, observer);
                       }
                   }
   
   (So when phase is IN_PROGRESS it will get the transactionService and it fails with that message).
   
   
   
   Is this condition correct in 2.0.16? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org