Implement a Dynamic CFlow
Overview Control flow is a runtime construct. A dynamic cflow will be called before the execution of the advices/interceptors it wraps. If it returns true then the advices execution. It allows you to do runtime dynamic checks at runtime to determine whether or not you want to run an advice stack. Step One To implement a Dynamic CFlow you first need to implement org.jboss.aop.pointcut.DynamicCFlow public interface DynamicCFlow { boolean shouldExecute(Invocation invocation); } Put in the logic you want to run at runtime into the shouldExecution method. Step Two Step two is to declare the Dynamic CFlow in the AOP XML file. See jboss-aop.xml: Then you can use the dynamic cflow in any cflow expression. The cflow will be allocate once and only once for the entire VM. Configure with XML If you want to do some XML configuration of the dynamic cflow instance, you can have it implement org.jboss.util.xml.XmlLoadable. public interface XmlLoadable { public void importXml(Element element); }