From dd1fc3f99233d98de33299355964f88d7f317dad Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 30 Apr 2013 15:23:43 +0100 Subject: [PATCH] Fix service integration tests --- .../bootstrap/service/shutdown/ShutdownEndpoint.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-bootstrap-service/src/main/java/org/springframework/bootstrap/service/shutdown/ShutdownEndpoint.java b/spring-bootstrap-service/src/main/java/org/springframework/bootstrap/service/shutdown/ShutdownEndpoint.java index 2ae1acc4b0..095062287e 100644 --- a/spring-bootstrap-service/src/main/java/org/springframework/bootstrap/service/shutdown/ShutdownEndpoint.java +++ b/spring-bootstrap-service/src/main/java/org/springframework/bootstrap/service/shutdown/ShutdownEndpoint.java @@ -48,10 +48,13 @@ public class ShutdownEndpoint implements ApplicationContextAware, @Autowired private ContainerProperties configuration = new ContainerProperties(); + private boolean shuttingDown = false; + @RequestMapping(value = "${endpoints.shutdown.path:/shutdown}", method = RequestMethod.POST) @ResponseBody public Map shutdown() { if (this.configuration.isAllowShutdown()) { + this.shuttingDown = true; return Collections. singletonMap("message", "Shutting down, bye..."); } else { @@ -70,7 +73,8 @@ public class ShutdownEndpoint implements ApplicationContextAware, @Override public void onApplicationEvent(ServletRequestHandledEvent event) { - if (this.context != null && this.configuration.isAllowShutdown()) { + if (this.context != null && this.configuration.isAllowShutdown() + && this.shuttingDown) { new Thread(new Runnable() { @Override