Question

In a Spring-based application, I have a session-scoped bean that implements DisposableBean interface. Are there any circumstances when its destroy method will not be called on the session expiration?

The application uses Spring version: 2.0.8 and runs on WebSphere 6.1.

Was it helpful?

Solution

Apparently, in WebSphere Network Deployment a DisposableBean may not be correctly destroyed. In a clustered environment the application server creates a copy of a session bean (with serialization/deserialization). Then, when session invalidates, it calls the destroy not on the original bean but on its copy. As a result, the destroy method on the original bean is never called in this case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top