类 InterruptControl
java.lang.Object
io.agentscope.core.interruption.InterruptControl
Per-session interrupt signal.
Holds the mutable interrupt flag, source, and optional user message for a single conversational
session. A stateless agent engine (e.g. ReActAgent) keeps one InterruptControl per
(userId, sessionId) slot (attached transiently to that slot's AgentState), so a
targeted interrupt(userId, sessionId) signals exactly one session's in-flight call without
affecting other concurrent calls on the same agent instance.
This holder is intentionally runtime-only: it is never serialized as part of the persisted agent state.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleanvoidreset()Clear the interrupt signal back to its initial (non-interrupted) state.Build anInterruptContextsnapshot of the current signal.voidtrigger(InterruptSource src, Msg msg) Raise the interrupt signal.
-
构造器详细资料
-
InterruptControl
public InterruptControl()
-
-
方法详细资料
-
trigger
Raise the interrupt signal.- 参数:
src- the interrupt source;nullis treated asInterruptSource.USERmsg- an optional user message associated with the interruption (ignored whennull)
-
isInterrupted
public boolean isInterrupted()- 返回:
trueif this session has been interrupted and not yet reset
-
getSource
- 返回:
- the current interrupt source
-
getUserMessage
- 返回:
- the user message associated with the interruption, or
null
-
reset
public void reset()Clear the interrupt signal back to its initial (non-interrupted) state. -
toContext
Build anInterruptContextsnapshot of the current signal.
-