JBoss.org Community Documentation
Any class that is instrumented by JBoss AOP, is forced to implement the
org.jboss.aop.Advised interface.
public interface InstanceAdvised { public InstanceAdvisor _getInstanceAdvisor(); public void _setInstanceAdvisor(InstanceAdvisor newAdvisor); } public interface Advised extends InstanceAdvised { public Advisor _getAdvisor(); }
The InstanceAdvisor is the interesting interface here. InstanceAdvisor allows you to insert Interceptors at the beginning or the end of the class's advice chain.
public interface InstanceAdvisor { public void insertInterceptor(Interceptor interceptor); public void removeInterceptor(String name); public void appendInterceptor(Interceptor interceptor); public void insertInterceptorStack(String stackName); public void removeInterceptorStack(String name); public void appendInterceptorStack(String stackName); public SimpleMetaData getMetaData(); }
So, there are three advice chains that get executed consecutively in the same java call stack. Those
interceptors that are added with the
insertInterceptor()
method for the given object
instance are executed first. Next, those advices/interceptors that were bound using regular
bind
s. Finally, those interceptors added with the
appendInterceptor()
method to the object
instance are executed. You can also reference
stack
s and insert/append full stacks
into the pre/post chains.
Besides interceptors, you can also append untyped metadata to the object instance via the getMetaData() method.