|
From: =?iso-8859-1?Q?<jp....@ti...> - 2003-08-12 16:45:51
|
Juergen,=0D=0A=0D=0AVery good! Sooner or later, this would to be made and= the sooner is the best. This enforces the strong side of Spring. =0D=0A=0D= =0AJust that Spring is now so rich that a full book is the only documenta= tion that could be at the high level of the framework. Clearly, so a book= exclusively about Spring (with some related topics such as Hibernate in = Spring) will have to follow the framework a day or another. It will be as= king for a lot of work but could drastically increase the use of Spring.=0D= =0A=0D=0AThe Rod's i21 was really great, but Spring is going over all hop= es. What a fantastic framework! =0D=0A=0D=0AJean-Pierre=0D=0A=0D=0A=0D=0A= Rod, everybody,=0D=0A=0D=0AI've just introduced support for a "destroy-me= thod", analogous to "init-method". There's also a respective DisposableBe= an interface with a destroy method now, analogous to InitializingBean wit= h its afterPropertiesSet. AbstractBeanFactory's new destroySingletons met= hod invokes such destroy methods on each of its cached singletons. Obviou= sly, this just makes sense for singletons: We don't keep track of prototy= pe instances.=0D=0A=0D=0AI've also added a "close" method to the Applicat= ionContext interface. The default implementation in AbstractApplicationCo= ntext invokes destroySingletons on the underlying BeanFactory. ContextLoa= derListener, ContextLoaderServlet, and FrameworkServlet close their respe= ctive contexts on shutdown now. This allows for proper lifecycle of all m= anaged singletons in a web application.=0D=0A=0D=0AThe rationale behind t= his is that we create resource leaks without this: For example, a Commons= DBCP BasicDataSource and a Hibernate SessionFactory need to be closed on= shutdown of a web app. Else, the former doesn't properly close its remai= ning connections, and the latter doesn't leave the JVM-level JCS cache in= a clean state.=0D=0A=0D=0AOn-the-fly restarting of a web app without res= tarting the server requires proper resource handling. The BasicDataSource= issue is obvious: The database might run out of connections. The Hiberna= te forums also state that there *are* issues with restarting when using a= JCS cache, that's why SessionFactory.close has been introduced in 2.0.=0D= =0A=0D=0ALocalSessionFactoryBean implements DisposableBean now, to care f= or proper SessionFactory closing. The recommendation for BasicDataSource = is to define it as follows. Note that we don't need any wrapper or the li= ke to achieve this, we're simply reusing the completely Spring-unaware Ba= sicDataSource :-)=0D=0A=0D=0A <bean id=3D"dataSource" class=3D"org.apach= e.commons.dbcp.BasicDataSource" destroy-method=3D"close">=0D=0A <prope= rty name=3D"driverClassName"><value>com.mysql.jdbc.Driver</value></proper= ty>=0D=0A ...=0D=0A </bean>=0D=0A=0D=0AI hope you consider this a val= uable addition. If there aren't any objections, I'll commit it tonight. P= lease, before taking a snapshot for the new module, ask me if I'm done! ;= -)=0D=0A=0D=0AJuergen=0D=0A=0A=0A********** L'ADSL A 20 EUR/MOIS*********= *=0ATiscali propose l'ADSL le moins cher du march=E9 : 20 EUR/mois et le = modem ADSL offert ! =0APour profiter de cette offre exceptionnelle, cliqu= ez ici : http://register.tiscali.fr/adsl/=0AOffre soumise =E0 conditions.= =0A |