Description
In RestartManager.java, the performRestart() method uses a hardcoded Thread.sleep(1000) between stopping and starting an application. This approach is fragile because:
- The stop operation may not complete within 1 second (especially for apps with long shutdown hooks)
- 1 second may be unnecessarily long for apps that stop quickly
Thread.sleep() wastes a thread that could be used for other work
- If the thread is interrupted during sleep, the restart may proceed with a partially stopped application
Location
platform-core/src/main/java/org/flossware/platform/core/RestartManager.java
performRestart() method, Thread.sleep(1000) between stop and start calls
Impact
- Unreliable restarts: if stop takes longer than 1 second, start may fail or conflict
- Wasted time: simple apps wait the full second unnecessarily
- Thread waste: sleeping thread cannot serve other requests
Suggested Fix
- Wait for the stop operation to complete (using a completion callback or polling the application state) before starting
- Use a
CompletableFuture chain instead of blocking sleep
- If a delay is truly needed, make it configurable rather than hardcoded
Labels
bug
Description
In
RestartManager.java, theperformRestart()method uses a hardcodedThread.sleep(1000)between stopping and starting an application. This approach is fragile because:Thread.sleep()wastes a thread that could be used for other workLocation
platform-core/src/main/java/org/flossware/platform/core/RestartManager.javaperformRestart()method,Thread.sleep(1000)between stop and start callsImpact
Suggested Fix
CompletableFuturechain instead of blocking sleepLabels
bug