当前位置:网站首页>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);
}
}
边栏推荐
- PyTorch中在反向传播前为什么要手动将梯度清零?
- 知其然,而知其所以然,JS 对象创建与继承【汇总梳理】
- [academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time
- cipher
- The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
- [leetcode周赛]第300场——6110. 网格图中递增路径的数目-较难
- DriveSeg:动态驾驶场景分割数据集
- What does a really excellent CTO look like in my eyes
- Understanding of database architecture
- Suffix derivation based on query object fields
猜你喜欢
Record: MySQL changes the time zone
【LeetCode】【SQL】刷题笔记
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
PyTorch中在反向传播前为什么要手动将梯度清零?
ActiveMQ的基础
235. The nearest common ancestor of the binary search tree [LCA template + same search path]
22.2.14 -- station B login with code -for circular list form - 'no attribute' - 'needs to be in path selenium screenshot deviation -crop clipping error -bytesio(), etc
User identity used by startup script and login script in group policy
Using the visualization results, click to appear the corresponding sentence
Record: solve the problem that MySQL is not an internal or external command environment variable
随机推荐
How about the Moco model?
[disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]
Random numbers in a long range, is that right- Random number in long range, is this the way?
How to read the source code [debug and observe the source code]
Typescript configuration
DriveSeg:动态驾驶场景分割数据集
Php based campus lost and found platform (automatic matching push)
leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】
my. INI file not found
High concurrency Architecture - distributed search engine (ES)
达梦数据库的物理备份和还原简解
【LeetCode】【SQL】刷题笔记
Compose LazyColumn 顶部添加控件
C enum contains value - C enum contains value
Record: MySQL changes the time zone
2020 intermediate financial management (escort class)
Today I am filled with emotion
The earliest record
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
组策略中开机脚本与登录脚本所使用的用户身份