There could be consequences for apps that have more complex context
hierarchies, but RestartEndpoint doesn't work well at all for those
apps anyway, so we are probably safe to just make changes in the
endpoint itself.
Fixes gh-333
@ -155,7 +160,7 @@ public class RestartEndpoint extends AbstractEndpoint<Boolean>
@@ -155,7 +160,7 @@ public class RestartEndpoint extends AbstractEndpoint<Boolean>
// If running in a webapp then the context classloader is probably going to
// die so we need to revert to a safe place before starting again
overrideClassLoaderForRestart();
@ -164,6 +169,19 @@ public class RestartEndpoint extends AbstractEndpoint<Boolean>
@@ -164,6 +169,19 @@ public class RestartEndpoint extends AbstractEndpoint<Boolean>
returnthis.context;
}
privatevoidclose(){
ApplicationContextcontext=this.context;
while(contextinstanceofCloseable){
try{
((Closeable)context).close();
}
catch(IOExceptione){
logger.error("Cannot close context: "+context.getId(),e);