Interface SessionTurnGate
- All Known Implementing Classes:
LocalSessionTurnGate
public interface SessionTurnGate
Per-key mutual exclusion for gateway turns (user/channel inbound runs and subagent notification).
Implementations include LocalSessionTurnGate (process-local fair semaphore) and
control-plane hosted locks for cross-node coordination. When using a distributed turn gate,
ReActAgent conflictPolicy should be set to FAIL so
concurrent state writes surface as errors rather than silent overwrites.
-
Method Summary
-
Method Details
-
acquire
Acquires the turn slot for the given key, blocking until available or throwing when busy.- Parameters:
key- canonical gate key (typicallyMsgContext.canonicalKey())- Returns:
- a lease that must be closed to release the slot
- Throws:
InterruptedException- if the waiting thread is interruptedTurnBusyException- if the slot is held and the implementation uses a short acquire timeout (distributed gates)
-
isRunning
Non-blocking check: returnstruewhen a turn is currently held for the given key. Used byWakeupDispatcherto skip sessions that are already active.- Parameters:
key- canonical gate key- Returns:
truewhen a turn is in progress for the key
-