0 Replies Latest reply on Oct 16, 2012 10:57 AM by Moe Pad

    Intercept SessionSynchronization

    Moe Pad Newbie

      Hi,

       

      I try to intercept the methods of javax.ejb.SessionSynchronization with a decorator. My decorator looks like that:

       

      @Decoratorpublic abstract class EJBRollbackDecorator implements MyTestBean{
      
        @Inject
        @Delegate
        @Any
        private MyTestBean myTestBean;
      
        ByteArrayOutputStream serializedObject = new ByteArrayOutputStream();
        Logger logger = Logger.getLogger(this.getClass().getName());
      
        public EJBRollbackDecorator() {
        }
      
        @PostConstruct
        public void postConstruct() {
          logger.info("[DECORATOR]: constructed = " + this);
        }
      
        @Override
        public void afterBegin() {
          logger.info("[DECORATOR]: afterBegin");
        }
      
        @Override
        public void afterCompletion(boolean committed) {
          logger.info("[DECORATOR]: afterCompletion");
          
        }
      
        @Override
        public void decoratorTest() {
          logger.info("[DECORATOR]: decoratorTest = " + this);
        }
      }
      

       

      Of course, MyTestBean implements SessionSynchronization.

       

      When a new transaction is started (or committed) none of the methods of the decorator is called. But if I call the decoratorTest() method of my test bean everything works fine.

       

      Is this a bug or are the methods of SessionSynchronization not supposed to be intercepted?

       

      Thanks in advance,

      Moe