SessionTurnGate
public interface SessionTurnGate
源码Source
io/agentscope/harness/agent/gateway/SessionTurnGate.java:26–47定义会话轮次 Gate契约的接口。位于 io.agentscope.harness.agent.gateway 包。核心成员包括 acquire、isRunning。
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,
io.agentscope.core.ReActAgent conflictPolicy should be set to FAIL so
concurrent state writes surface as errors rather than silent overwrites.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public TurnLease acquire(String key) throws InterruptedException, TurnBusyException | 设置该参数。 Acquires the turn slot for the given key, blocking until available or throwing when busy. |
public boolean isRunning(String key) | 判断是否运行中。 Non-blocking check: returns `true` when a turn is currently held for the given key. |
方法详情Method Detail
acquire
public TurnLease acquire(String key) throws InterruptedException, TurnBusyException
设置该参数。
Acquires the turn slot for the given key, blocking until available or throwing when busy.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。canonical gate key (typically `MsgContext#canonicalKey()`) |
TurnLease返回TurnLease。a lease that must be closed to release the slot
InterruptedException可能抛出 `InterruptedException`。Thrown when the operation cannot be completed.TurnBusyException可能抛出 `TurnBusyException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/agent/gateway/SessionTurnGate.java:37isRunning
public boolean isRunning(String key)
判断是否运行中。
Non-blocking check: returns true when a turn is currently held for the given key.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。canonical gate key |
boolean返回布尔值,表示判断结果。`true` when a turn is in progress for the key
源码Source
io/agentscope/harness/agent/gateway/SessionTurnGate.java:46