Brian Topping(Migrated from SEC-1104) said:
I have a default ApacheDS server launched for testing via element in my spring config. This is inside a webapp, and the context is loaded through a servlet context listener (if that makes any difference).
ApacheDSContainer implements both Lifecycle and DisposableBean. Both destroy methods get called, but neither checks the ‘running’ field before trying to shut down the ApacheDS server. The first shutdown works, but since the server is contacted over a socket, the second attempt hangs until the socket times out.
The easy fix is to just check the ‘running’ field in the stop() method and don’t do anything if the server isn’t running.
Brian Topping said:
On further inspection, this problem was coincidental to starting to use the ApacheDSContainer, not causal. I believe there is a problem calling the stop method twice, although after cleaning up the code, my issue remains. So this could be set to a low priority or closed, although I will attach the patch here regardless.
Patch for ApacheDSContainer.java to clean up lifecycle semantics
Luke Taylor said:
Thanks for the report. I've added a check of the "running" flag in the stop() method but I've retained the Lifecycle interface (unlike your patch). The same bean instance could potentially be started and stopped without necessarily being destroyed.