Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Not any class can be intercepted in this way, both due to implementation limitation and for sake of performance, only classes that have marked itself with a marker interface ComponentMethodInterceptable can be intercepted for to apply above AOP pattern. All Manager, Adapter and DAO classes are currently marked with ComponentMethodInterceptable.

ComponentInstantiationPostProcessor is a CloudStack implemented Spring post processor that eventually implements the Customized AOP pattern. ComponentInstantiationPostProcessor uses CGLIB to replace loaded component instance with a CGLIB generated wrapper object that is a sub-class instance of the original object, in this way, it can provide hooks to all method calls to the object through ComponentMethodInterceptor.

The sub-class generated by CGLIB uses the naming convention implemented in ComponentNamingPolicy. All these generated classes are named after "EnhancedByCloudStack" pattern, you may notice it in log messages or in debug session.

4.6 Pluggable adapters

Adapter components usually works under the management of its manager component, a same set of adapter components may be used by multiple managers, and sometimes, order of the adapters may also be significant. Whether or not an adapter component is in action depends not only the existence of its <bean> declaration, but also the references in manager components.

...