Closed
Description
Eric Vigeant opened SPR-13425 and commented
Here is some simple code that will show the pattern:
ClassPathXmlApplicationContext ctx = ...
ctx.refresh(); // This works as expected
ctx.close(); // This closes the context correctly
ctx.refresh(); // This restarts the context properly
ctx.close(); // This does NOT close the context
I traced it down to the "closed" field in AbstractApplicationContext, it is initialized to false, it is set to true when closing, but it is never set again to false after it is restarted. This causes the doClose() method to do nothing.
Affects: 4.1.7, 4.2 GA
Issue Links:
- Close processing triggered by shutdown hook isn't thread safe [SPR-13556] #18132 Close processing triggered by shutdown hook isn't thread safe
Referenced from: commits 811de8e, 57125c0
Backported to: 4.1.8