Activiti7核心源码分析
2023-07-27 01:39:22 0 举报
AI智能生成
登录查看完整内容
Activiti源码分析
作者其他创作
大纲/内容
https://dpb-bobokaoya-sm.blog.csdn.net/article/details/89115420
命令模式
https://dpb-bobokaoya-sm.blog.csdn.net/article/details/89077040
责任链模式
1.设计模式
ProcessEngineConfigurationImpl中的init方法
initCommandContextFactory()
initTransactionContextFactory()
是否重用上下文
contextReusePossible
事务的传播属性
propagation
初始化CommondConfig对象
并且绑定在了defaultCommandConfig属性中
initDefaultCommandConfig()
设置不可以重用上下文
不支持事务的传播属性
并且绑定在了schemaCommandConfig属性中
initSchemaCommandConfig()
完成commandInvoker的初始化
命令模式的执行者
责任链模式的最后一个节点
CommandInvoker
initCommandInvoker()
完成commandInterceptors的初始化
自定义的前置拦截器
customPreCommandInterceptors
默认的拦截器
getDefaultCommandInterceptors
自定义的后置拦截器
customPostCommandInterceptors
最后一个拦截器
commondInvoker
组装命令的拦截器链
initCommandInterceptors()
把上面获取的拦截器设置为链路关系
初始化拦截器链--initInterceptorChain()
获取责任链的第一个节点
绑定defaultCommandConfig
绑定第一个拦截器
初始化CommandExecutor
initCommandExecutor()
initCommandExecutors()
public void initService(Object service) { if (service instanceof ServiceImpl) { ((ServiceImpl) service).setCommandExecutor(commandExecutor); } }
initService(repositoryService); initService(runtimeService); initService(historyService); initService(taskService); initService(managementService); initService(dynamicBpmnService);
给各个XXXService绑定 commandExecutor
相关的xxxService在成员变量出已经完成了实例化
initServices()
init()
2.初始化代码
Deployment deploy = processEngine.getRepositoryService().createDeployment() .addClasspathResource(\"flow/04-mutiInstance/muti-instance-05-sub-process.bpmn20.xml\") .name(\"多实例5\") .deploy();
RepositoryService
部署并构建Deployment对象
commandExecutor.execute(new DeployCmd<Deployment>(deploymentBuilder));
first-责任链路中的第一个节点
LogInterceptor
SpringTransactionInterceptor
CommandContextInterceptor
TransactionContextInterceptor
责任链中的最后一个节点
具体处理部署的操作
部署信息
ACT_RE_DEPLOYMENT
流程定义信息
ACT_RE_PROCDEF
都只是做了缓存的操作
insert/delete/update
在所有操作完成后在统一完成添加更新和删除的数据库操作
flush
DBSqlSession
DeployCmd
涉及到的拦截器
deploy方法
DeploymentBuilder
部署流程
3.核心流程代码
Activiti7核心源码分析
0 条评论
回复 删除
下一页