[jboss-user] [EJB3] - Intercept SessionSynchronization

Moe Pad do-not-reply at jboss.com
Tue Oct 16 10:57:16 EDT 2012


Moe Pad [https://community.jboss.org/people/moepad] created the discussion

"Intercept SessionSynchronization"

To view the discussion, visit: https://community.jboss.org/message/765073#765073

--------------------------------------------------------------
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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/765073#765073]

Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121016/e3e6a56b/attachment-0001.html 


More information about the jboss-user mailing list