Class SessionManager

java.lang.Object
dev.tachyonmcp.core.server.session.SessionManager
All Implemented Interfaces:
AutoCloseable

@InternalApi public class SessionManager extends Object implements AutoCloseable
Manages the lifecycle of MCP sessions.
  • Constructor Details

    • SessionManager

      public SessionManager(SessionStore store)
      Creates a session manager backed by the given store.
  • Method Details

    • createSession

      public Session createSession(String sessionId)
      Creates a session with no initial connection.
    • createSession

      public Session createSession(String sessionId, SseConnection connection)
      Creates a session with the given SSE connection.
    • getSession

      public Optional<Session> getSession(@Nullable String sessionId)
      Returns the session for the given ID, if present.
    • allSessions

      public Collection<Session> allSessions()
      Returns all active sessions.
    • removeSession

      public void removeSession(String sessionId)
      Removes and closes the session with the given ID.
    • startJanitor

      public void startJanitor(Duration ttl, Duration interval)
      Starts the background janitor that closes expired sessions.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable