Class CachingWebPanelRendererTracker

java.lang.Object
com.atlassian.templaterenderer.velocity.CachingWebPanelRendererTracker
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.DisposableBean

public class CachingWebPanelRendererTracker extends Object implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.DisposableBean
Tracks the creation of AbstractCachingWebPanelRenderer and invokes AbstractCachingWebPanelRenderer.destroy() method when the application context is closed.

The subclasses of AbstractCachingWebPanelRenderer are defined in atlassian-plugin.xml as web-panel-renderer instead of component. So they are not defined as a bean in the generated META-INF/spring/atlassian-plugins-components.xml. They are instantiated by the WebPanelRendererModuleDescriptor invoking the createModule() method of a ModuleFactory, which in a Spring-backed plugin system calls the Spring IoC container programmatically to instantiate an instance of the given module class and autowire it. Beans created this way are not defined as part of the Spring application context; thus, when the Spring application context is closed, the destroy() method of these beans are not called even if they implement the DisposableBean interface. Therefore, we need to track AbstractCachingWebPanelRenderer programmatically.

Since:
v1.3.4
  • Constructor Details

    • CachingWebPanelRendererTracker

      public CachingWebPanelRendererTracker()
  • Method Details

    • postProcessBeforeInitialization

      public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      Throws:
      org.springframework.beans.BeansException
    • postProcessAfterInitialization

      public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
      Specified by:
      postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      Throws:
      org.springframework.beans.BeansException
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception