Hi Chad,
I think I have a problem somewhat related to JIRA issue SPRING-36: it is a feature request that I made (and I thank you for implementing it).
The problem appears only when the andromda-spring-cartridge's 'session-ejbs' namespace property is false (not using EJBs).
Before you implemented my request:
------------------------------------------------------
The generated ServiceLocator was responsible for instantiating an ApplicationContext.
The problem is this context (ClassPathXmlApplicationContext, which is a ConfigurableApplicationContext) was never close()d.
This means that if the ApplicationContext contained DisposableBeans or beans with a 'destroy-method' attribute, their "destroy" method would never be called and their resources would never be released. E.g.: a local pooling DataSource, a org.springframework.scheduling.timer.TimerFactoryBean, ...
After you implemented my request:
------------------------------------------------------
The ServiceLocator has been reimplemented to delegate the ApplicationContext creation to a ContextSingletonBeanFactoryLocator and now accesses the ApplicationContext through a BeanFactoryReference.
The problem remains because BeanFactoryReference.release() is never called anywhere. This method decrements the reference counter and closes the ApplicationContext once it reaches 0.
Note: This method is automatically called in org.springframework.ejb.support.AbstractEnterpriseBean.ejbRemove() (a super class of org.springframework.ejb.support.AbstractStatelessSessionBean).
One solution would be to add the following method to the ServiceLocator singleton, and call it when the web application is stopped:
public synchronized void destroy() {
if (beanFactoryReference != null) {
beanFactoryReference.release();
beanFactoryReference = null;
}
}
What do you think?
Thanks in advance,
Johnny
- [Andromda-devel] Possible resource leaks? johnny . macchione
- [Andromda-devel] RE: Possible resource leaks? Chad Brandon
- RE: [Andromda-devel] Possible resource leaks? Chad Brandon
