当前位置:网站首页>Comments on flowable source code (37) asynchronous job processor
Comments on flowable source code (37) asynchronous job processor
2022-07-03 19:08:00 【jinyangjie0】
Flowable Source code address :https://github.com/flowable/flowable-engine
Flowable-6.7.2 Source code comment address :https://github.com/solojin/flowable-6.7.2-annotated
Package path :org.flowable.engine.impl.jobexecutor
AsyncCompleteCallActivityJobHandler Asynchronous completion invokes the active job processor
/** * Asynchronous completion invokes the active job processor * Job processor that asynchronously ends execution {@link JobHandler} Realization . * The main use case is to handle parallel multi instance invocation activities , The subprocess has an asynchronous step before reaching the end event . * Asynchronous locking occurs at the level of child process instances , But the end event will execute to complete the parent process instance within the scope * Call the completion callback method of the activity , And may cause optimistic locking exceptions . * By scheduling jobs in the context of the parent process instance , The correct lock will be used . * * @author Joram Barrez */
public class AsyncCompleteCallActivityJobHandler implements JobHandler {
// type : Asynchronously complete the call activity
public static final String TYPE = "async-complete-call-actiivty";
@Override
public String getType() {
return TYPE;
}
@Override
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
// the executionId of the job = the parent execution, which will be used for locking
ExecutionEntity childProcessInstanceExecutionEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(configuration); // the child process instance execution
CommandContextUtil.getAgenda(commandContext).planEndExecutionOperationSynchronous(childProcessInstanceExecutionEntity);
}
}
AsyncSendEventJobHandler Asynchronously send event job processor
/** * Asynchronously send event job processor * * @author Tijs Rademakers */
public class AsyncSendEventJobHandler implements JobHandler {
// type : Send events asynchronously
public static final String TYPE = "async-send-event";
@Override
public String getType() {
return TYPE;
}
@Override
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
ExecutionEntity executionEntity = (ExecutionEntity) variableScope;
FlowElement flowElement = executionEntity.getCurrentFlowElement();
if (!(flowElement instanceof SendEventServiceTask)) {
throw new FlowableException(String.format("Unexpected activity type found for job %s, at activity %s", job.getId(), flowElement.getId()));
}
Object behavior = ((SendEventServiceTask) flowElement).getBehavior();
if (!(behavior instanceof ActivityBehavior)) {
throw new FlowableException(String.format("Unexpected activity behavior found for job %s, at activity %s: %s",
job.getId(), flowElement.getId(), behavior.getClass()));
}
try {
ActivityBehavior activityBehavior = (ActivityBehavior) behavior;
commandContext.addAttribute(TYPE, true); // Will be read in the SendEventTaskActivityBehavior
activityBehavior.execute(executionEntity);
} finally {
commandContext.removeAttribute(TYPE);
}
}
}
AsyncContinuationJobHandler Asynchronous continuation job handler
/** * Asynchronous continuation job handler * * @author Tijs Rademakers */
public class AsyncContinuationJobHandler implements JobHandler {
// type : Asynchronous continuation
public static final String TYPE = "async-continuation";
@Override
public String getType() {
return TYPE;
}
@Override
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
ExecutionEntity executionEntity = (ExecutionEntity) variableScope;
if (CommandContextUtil.getProcessEngineConfiguration(commandContext).isLoggingSessionEnabled()) {
FlowElement flowElement = executionEntity.getCurrentFlowElement();
BpmnLoggingSessionUtil.addAsyncActivityLoggingData("Executing async job for " + flowElement.getId() + ", with job id " + job.getId(),
LoggingSessionConstants.TYPE_SERVICE_TASK_EXECUTE_ASYNC_JOB, job, flowElement, executionEntity);
}
CommandContextUtil.getAgenda(commandContext).planContinueProcessSynchronousOperation(executionEntity);
}
}
AsyncTriggerJobHandler Trigger job processor asynchronously
/** * Trigger job processor asynchronously * * @author Tijs Rademakers */
public class AsyncTriggerJobHandler implements JobHandler {
// type : Asynchronous trigger
public static final String TYPE = "async-trigger";
@Override
public String getType() {
return TYPE;
}
@Override
public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
ExecutionEntity executionEntity = (ExecutionEntity) variableScope;
CommandContextUtil.getAgenda(commandContext).planTriggerExecutionOperation(executionEntity);
}
}
边栏推荐
- 我眼中真正优秀的CTO长啥样
- High concurrency architecture cache
- Ego planner code parsing Bspline_ Optimizer section (1)
- PyTorch中在反向传播前为什么要手动将梯度清零?
- OSPF - detailed explanation of stub area and full stub area
- Flutter network and data storage framework construction-b1
- SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
- [leetcode] [SQL] notes
- Today I am filled with emotion
- Nous avons fait une plateforme intelligente de règlement de détail
猜你喜欢

There are several levels of personal income tax
![[leetcode] [SQL] notes](/img/8d/160a03b9176b8ccd8d52f59d4bb47f.png)
[leetcode] [SQL] notes

Recommend a simple browser tab
![235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]](/img/f5/f2d244e7f19e9ddeebf070a1d06dce.png)
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]

【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】

application

Flutter network and data storage framework construction-b1

我們做了一個智能零售結算平臺

【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁

2020 intermediate financial management (escort class)
随机推荐
[academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time
SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
Zero length array
Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
Simple solution of physical backup and restore of Damon database
Su embedded training - Day10
Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
Why should the gradient be manually cleared before back propagation in pytorch?
Using the visualization results, click to appear the corresponding sentence
Day_ 18 IO stream system
Leetcode: 11. Récipient contenant le plus d'eau [double pointeur + cupidité + enlèvement de la plaque la plus courte]
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
leetcode:556. Next larger element III [simulation + change as little as possible]
leetcode:11. 盛最多水的容器【雙指針 + 貪心 + 去除最短板】
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
Valentine's Day - make an exclusive digital collection for your lover
High concurrency Architecture - distributed search engine (ES)
Thinking about festivals
Unity webgl optimization
leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】