类 Chain
java.lang.Object
dev.tinyflow.core.chain.Chain
-
字段概要
字段修饰符和类型字段说明protected ChainStateRepositoryprotected final ChainDefinitionprotected EventManagerprivate static final ThreadLocal<Chain>private static final org.slf4j.Loggerprotected NodeStateRepositoryprotected Stringprotected TriggerScheduler -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private longcalculateNextRetryDelay(int attempt, long maxDelayMs) Calculates the next retry delay using exponential backoff with jitter.static ChainvoidexecuteNode(Node node, Trigger trigger) <T> TexecuteWithLock(String instanceId, long timeout, TimeUnit unit, Supplier<T> action) getNodeState(String nodeId) getNodeState(String stateInstanceId, String nodeId) getState()private ChainStatushandleNodeError(String nodeId, Throwable throwable) private voidhandleNodeResult(Node node, Map<String, Object> prevNodeResult, String triggerEdgeId, Throwable error) private booleanisSameParent(Node node, Node next) 判断两个节点是否具有相同的父节点voidnotifyEvent(Event event) voidvoidresume()voidprivate void为指定节点调度下一次执行voidscheduleNode(Node node, String edgeId, TriggerType type, long delayMs) private voidscheduleOutwardNodes(Node node, Map<String, Object> result) voidsetChainStateRepository(ChainStateRepository chainStateRepository) voidsetEventManager(EventManager eventManager) voidsetNodeStateRepository(NodeStateRepository nodeStateRepository) voidsetStateInstanceId(String stateInstanceId) voidsetStatusAndNotifyEvent(ChainStatus status) voidsetStatusAndNotifyEvent(String stateInstanceId, ChainStatus status) voidsetTriggerScheduler(TriggerScheduler triggerScheduler) private booleanshouldSkipNode(Node node, String edgeId) private voidsleepUninterruptibly(long millis) Sleeps for the specified duration, silently ignoring interrupts but preserving the interrupt status.voidvoidsuspend()voidupdateNodeStateSafely(String nodeId, NodeStateModifier modifier) updateNodeStateSafely(String stateInstanceId, String nodeId, NodeStateModifier modifier) updateStateSafely(ChainStateModifier modifier) Safely updates the chain state with optimistic locking and retry-on-conflict.updateStateSafely(String stateInstanceId, ChainStateModifier modifier)
-
字段详细资料
-
log
-
EXECUTION_THREAD_LOCAL
-
definition
-
stateInstanceId
-
chainStateRepository
-
nodeStateRepository
-
eventManager
-
triggerScheduler
-
-
构造器详细资料
-
Chain
-
-
方法详细资料
-
currentChain
-
notifyEvent
-
setStatusAndNotifyEvent
-
setStatusAndNotifyEvent
-
updateStateSafely
Safely updates the chain state with optimistic locking and retry-on-conflict.- 参数:
modifier- the modifier that applies changes and declares updated fields- 抛出:
ChainUpdateTimeoutException- if update cannot succeed within timeout
-
updateStateSafely
-
updateNodeStateSafely
-
updateNodeStateSafely
public NodeState updateNodeStateSafely(String stateInstanceId, String nodeId, NodeStateModifier modifier) -
calculateNextRetryDelay
Calculates the next retry delay using exponential backoff with jitter.- 参数:
attempt- the current retry attempt (1-based)maxDelayMs- the maximum delay in milliseconds- 返回:
- the delay in milliseconds to wait before next retry
-
sleepUninterruptibly
Sleeps for the specified duration, silently ignoring interrupts but preserving the interrupt status.- 参数:
millis- the length of time to sleep in milliseconds
-
start
-
executeNode
-
getNodeState
-
getNodeState
-
executeWithLock
-
shouldSkipNode
-
handleNodeResult
-
scheduleNextForNode
为指定节点调度下一次执行- 参数:
node- 要调度的节点result- 节点执行结果byEdigeId- 触发边的ID
-
scheduleOutwardNodes
-
isSameParent
判断两个节点是否具有相同的父节点- 参数:
node- 第一个节点next- 第二个节点- 返回:
- 如果两个节点的父节点ID相同则返回true,否则返回false
-
scheduleNode
-
handleNodeError
-
suspend
-
suspend
-
resume
-
resume
-
output
-
getEventManager
-
setEventManager
-
getChainStateRepository
-
setChainStateRepository
-
getDefinition
-
getTriggerScheduler
-
setTriggerScheduler
-
getNodeStateRepository
-
setNodeStateRepository
-
getStateInstanceId
-
getState
-
getState
-
setStateInstanceId
-