Skip to content

Commit f7519a3

Browse files
plajkoRyan Baxter
authored and
Ryan Baxter
committed
RestartEndpoint fixed (spring-projects#366)
* RestartEndpoint fixed * method naming fix
1 parent 6560e88 commit f7519a3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spring-cloud-context/src/main/java/org/springframework/cloud/context/restart/RestartEndpoint.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.Closeable;
2020
import java.io.IOException;
21+
import java.util.Collections;
2122

2223
import org.apache.commons.logging.Log;
2324
import org.apache.commons.logging.LogFactory;
@@ -86,8 +87,14 @@ public void onApplicationEvent(ApplicationPreparedEvent input) {
8687
}
8788

8889
@WriteOperation
89-
// FIXME: map with "message: Restarting" or couldn't restart
90-
public Boolean restart() {
90+
public Object restart() {
91+
Thread thread = new Thread(this::safeRestart);
92+
thread.setDaemon(false);
93+
thread.start();
94+
return Collections.singletonMap("message", "Restarting");
95+
}
96+
97+
private Boolean safeRestart() {
9198
try {
9299
doRestart();
93100
logger.info("Restarted");

0 commit comments

Comments
 (0)