当前位置:网站首页>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);
}
}
边栏推荐
- Understanding of database architecture
- Verilog HDL continuous assignment statement, process assignment statement, process continuous assignment statement
- OSPF - detailed explanation of stub area and full stub area
- Simulation scheduling problem of SystemVerilog (1)
- I didn't cancel
- EGO Planner代码解析bspline_optimizer部分(1)
- We have built an intelligent retail settlement platform
- In addition to the prickles that pierce your skin, there are poems and distant places that originally haunt you in plain life
- Differential constrained SPFA
- Analyse du Code du planificateur ego bspline Section Optimizer (1)
猜你喜欢
User identity used by startup script and login script in group policy
These problems should be paid attention to in the production of enterprise promotional videos
我眼中真正优秀的CTO长啥样
2022.02.11
Record the errors reported when running fluent in the simulator
EGO Planner代码解析bspline_optimizer部分(3)
PyTorch中在反向传播前为什么要手动将梯度清零?
Nous avons fait une plateforme intelligente de règlement de détail
[mathematical modeling] ship three degree of freedom MMG model based on MATLAB [including Matlab source code 1925]
Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
随机推荐
Foundation of ActiveMQ
Hard disk monitoring and analysis tool: smartctl
ActiveMQ的基础
Verilog HDL continuous assignment statement, process assignment statement, process continuous assignment statement
Analysis of dart JSON encoder and decoder
Reading a line from ifstream into a string variable
How about the Moco model?
“google is not defined” when using Google Maps V3 in Firefox remotely
235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
Max of PHP FPM_ Some misunderstandings of children
SQL injection for Web Security (1)
EGO Planner代码解析bspline_optimizer部分(3)
知其然,而知其所以然,JS 对象创建与继承【汇总梳理】
Driveseg: dynamic driving scene segmentation data set
Day_ 18 IO stream system
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
Ego planner code parsing Bspline_ Optimizer section (2)
Understanding of database architecture
DriveSeg:动态驾驶场景分割数据集
The installation path cannot be selected when installing MySQL 8.0.23