Skip to content

Commit a31e36e

Browse files
committed
Fix: Set isClosing flag in closeGracefully method as documented
The FIXME comment noted that the javadoc claimed to use the isClosing flag but it wasn't actually being set. This commit: - Adds isClosing = true at the start of closeGracefully() - Updates the javadoc to accurately reflect the behavior - Removes the outdated FIXME comment This ensures new connections are properly rejected during graceful shutdown.
1 parent d14a423 commit a31e36e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/transport/ShenyuSseServerTransportProvider.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,15 @@ public Mono<Void> notifyClients(final String method, final Object params) {
193193
.then();
194194
}
195195

196-
// FIXME: This javadoc makes claims about using isClosing flag but it's not
197-
// actually
198-
// doing that.
199-
200196
/**
201-
* Closes all active sessions gracefully. This method should be called when the
202-
* transport is shutting down to ensure all sessions are closed properly.
197+
* Closes all active sessions gracefully. This method sets the isClosing flag
198+
* to prevent new connections, then closes all existing sessions properly.
203199
*
204200
* @return A Mono that completes when all sessions have been closed
205201
*/
206202
@Override
207203
public Mono<Void> closeGracefully() {
204+
isClosing = true;
208205
return Flux.fromIterable(sessions
209206
.values())
210207
.doFirst(() -> LOGGER.debug("Initiating graceful shutdown with {} active sessions", sessions.size()))

0 commit comments

Comments
 (0)