From EJB IN Action 3.0 "In the pure AOP world, interception takes place at various points (called point cuts) including at the beginning of a method, at the end of a method, and when an exception is triggered."
With @Interceptors annotation applied to a bean method, the registered class's AroundInvoke method will be invoked when the bean method is invoked by the client which will log the entry point of the method and finally invoke proceed() on InvocationContext. How can one log @ the end of the bean method and when an exception is thrown? as stated in the EJB 3 in action How can one access the return values
How can one log @ the end of the bean method and when an exception is thrown?
That's an AOP concept, so maybe you should read something about AOP if you're interested in it. Your object is proxied, so when you think you're calling a method of your bean, you're actually calling the method of a proxy of your bean. In the proxy, anything can be controlled. Before/After calling the actual method of your bean, the proxy can do things, like calling interceptor methods. Same for exceptions, where the proxy can catch some exceptions and do something special when it happens.
No, anything other than @AroundInvoke is not supported.
Joined: Aug 05, 2006
Limited supported in EJB 3.0. I hope they come up with annotations to handle exit and exceptions in a method. Only then one can think of implementing Logging [Cross Cutting concern] in a separate module. With current support its pretty much like a servlet filter.