RestartEndpoint fixed (#366)
* RestartEndpoint fixed * method naming fix
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user