RestartEndpoint fixed (#366)

* RestartEndpoint fixed

* method naming fix
This commit is contained in:
Peter Lajko
2018-05-10 21:44:30 +02:00
committed by Ryan Baxter
parent 6560e8896c
commit f7519a30ad

View File

@@ -18,6 +18,7 @@ package org.springframework.cloud.context.restart;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collections;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -86,8 +87,14 @@ public class RestartEndpoint implements ApplicationListener<ApplicationPreparedE
}
@WriteOperation
// FIXME: map with "message: Restarting" or couldn't restart
public Boolean restart() {
public Object restart() {
Thread thread = new Thread(this::safeRestart);
thread.setDaemon(false);
thread.start();
return Collections.singletonMap("message", "Restarting");
}
private Boolean safeRestart() {
try {
doRestart();
logger.info("Restarted");