Package io.jenkins.plugins.mcp.server
Class McpServerShutdownListener
java.lang.Object
io.jenkins.plugins.mcp.server.McpServerShutdownListener
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
@Extension
public class McpServerShutdownListener
extends Object
Listens for Jenkins shutdown events and notifies MCP clients.
This class hooks into Jenkins' termination lifecycle to update the health endpoint status, allowing connected MCP clients to detect when Jenkins is shutting down and prepare for reconnection.
The shutdown sequence:
- Jenkins initiates shutdown
- This terminator is called, setting the health endpoint to "shutting_down" state
- A grace period allows clients to detect the state change via the health endpoint
- Jenkins completes shutdown
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
McpServerShutdownListener
public McpServerShutdownListener()
-
-
Method Details
-
onShutdown
Called when Jenkins is shutting down.Sets the MCP server health endpoint to shutdown state and waits for a brief grace period to allow clients to detect the shutdown.
- Throws:
InterruptedException- if the grace period sleep is interrupted
-