Class SessionRegistry.Builder
java.lang.Object
ai.singlr.runtime.SessionRegistry.Builder
- Enclosing class:
SessionRegistry
Fluent builder for
SessionRegistry.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the immutable registry.Override the clock used to stamp terminal sessions.withFactory(Function<ai.singlr.session.SessionOptions, ai.singlr.session.AgentSession> factory) Override the session factory.withMaxSessions(int maxSessions) Cap registered sessions.
-
Method Details
-
withFactory
public SessionRegistry.Builder withFactory(Function<ai.singlr.session.SessionOptions, ai.singlr.session.AgentSession> factory) Override the session factory. Production code keeps the default; tests supply a stub.- Parameters:
factory- non-null factory- Returns:
- this builder
- Throws:
NullPointerException- iffactoryis null
-
withClock
Override the clock used to stamp terminal sessions. Tests use a fixed clock for deterministic eviction; production keepsClock.systemUTC().- Parameters:
clock- non-null clock- Returns:
- this builder
- Throws:
NullPointerException- ifclockis null
-
withMaxSessions
Cap registered sessions. WhenSessionRegistry.create(SessionOptions)would push the count over this number, the registry evicts the oldest terminal session first; if no terminal session is available, the create call throws.- Parameters:
maxSessions- positive cap- Returns:
- this builder
- Throws:
IllegalArgumentException- ifmaxSessionsis not positive
-
build
-