by yan 20220223

ProcessEngineConfiguration 类图

public void init() {initConfigurators();configuratorsBeforeInit();initHistoryLevel();initExpressionManager();if (usingRelationalDatabase) {initDataSource();}initAgendaFactory();initHelpers();initVariableTypes();initBeans();initScriptingEngines();initClock();initBusinessCalendarManager();initCommandContextFactory();initTransactionContextFactory();initCommandExecutors();initServices();initIdGenerator();initBehaviorFactory();initListenerFactory();initBpmnParser();initProcessDefinitionCache();initProcessDefinitionInfoCache();initKnowledgeBaseCache();initJobHandlers();initJobManager();initAsyncExecutor();initTransactionFactory();if (usingRelationalDatabase) {initSqlSessionFactory();}initSessionFactories();initDataManagers();initEntityManagers();initHistoryManager();initJpa();initDeployers();initDelegateInterceptor();initEventHandlers();initFailedJobCommandFactory();initEventDispatcher();initProcessValidator();initDatabaseEventLogging();configuratorsAfterInit();}// command executors// public void initCommandExecutors() {initDefaultCommandConfig();initSchemaCommandConfig();initCommandInvoker();initCommandInterceptors();initCommandExecutor();}public void initDefaultCommandConfig() {if (defaultCommandConfig == null) {defaultCommandConfig = new CommandConfig();}}public void initSchemaCommandConfig() {if (schemaCommandConfig == null) {schemaCommandConfig = new CommandConfig().transactionNotSupported();}}public void initCommandInvoker() {if (commandInvoker == null) {if (enableVerboseExecutionTreeLogging) {commandInvoker = new DebugCommandInvoker();} else {commandInvoker = new CommandInvoker();}}}public void initCommandInterceptors() {if (commandInterceptors == null) {commandInterceptors = new ArrayList<CommandInterceptor>();if (customPreCommandInterceptors != null) {commandInterceptors.addAll(customPreCommandInterceptors);}commandInterceptors.addAll(getDefaultCommandInterceptors());if (customPostCommandInterceptors != null) {commandInterceptors.addAll(customPostCommandInterceptors);}commandInterceptors.add(commandInvoker);}}public Collection<? extends CommandInterceptor> getDefaultCommandInterceptors() {List<CommandInterceptor> interceptors = new ArrayList<CommandInterceptor>();interceptors.add(new LogInterceptor());CommandInterceptor transactionInterceptor = createTransactionInterceptor();if (transactionInterceptor != null) {interceptors.add(transactionInterceptor);}if (commandContextFactory != null) {interceptors.add(new CommandContextInterceptor(commandContextFactory, this));}if (transactionContextFactory != null) {interceptors.add(new TransactionContextInterceptor(transactionContextFactory));}return interceptors;}public void initCommandExecutor() {if (commandExecutor == null) {CommandInterceptor first = initInterceptorChain(commandInterceptors);commandExecutor = new CommandExecutorImpl(getDefaultCommandConfig(), first);}}public CommandInterceptor initInterceptorChain(List<CommandInterceptor> chain) {if (chain == null || chain.isEmpty()) {throw new ActivitiException("invalid command interceptor chain configuration: " + chain);}for (int i = 0; i < chain.size() - 1; i++) {chain.get(i).setNext(chain.get(i + 1));}return chain.get(0);}public abstract CommandInterceptor createTransactionInterceptor();// DataSource// ///public void initDataSource() {if (dataSource == null) {if (dataSourceJndiName != null) {try {dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName);} catch (Exception e) {throw new ActivitiException("couldn't lookup datasource from " + dataSourceJndiName + ": " + e.getMessage(), e);}} else if (jdbcUrl != null) {if ((jdbcDriver == null) || (jdbcUsername == null)) {throw new ActivitiException("DataSource or JDBC properties have to be specified in a process engine configuration");}log.debug("initializing datasource to db: {}", jdbcUrl);PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword);if (jdbcMaxActiveConnections > 0) {pooledDataSource.setPoolMaximumActiveConnections(jdbcMaxActiveConnections);}if (jdbcMaxIdleConnections > 0) {pooledDataSource.setPoolMaximumIdleConnections(jdbcMaxIdleConnections);}if (jdbcMaxCheckoutTime > 0) {pooledDataSource.setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime);}if (jdbcMaxWaitTime > 0) {pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime);}if (jdbcPingEnabled) {pooledDataSource.setPoolPingEnabled(true);if (jdbcPingQuery != null) {pooledDataSource.setPoolPingQuery(jdbcPingQuery);}pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor);}if (jdbcDefaultTransactionIsolationLevel > 0) {pooledDataSource.setDefaultTransactionIsolationLevel(jdbcDefaultTransactionIsolationLevel);}dataSource = pooledDataSource;}if (dataSource instanceof PooledDataSource) {// ACT-233: connection pool of Ibatis is not properly// initialized if this is not called!((PooledDataSource) dataSource).forceCloseAll();}}if (databaseType == null) {initDatabaseType();}}// myBatis SqlSessionFactory// public void initTransactionFactory() {if (transactionFactory == null) {if (transactionsExternallyManaged) {transactionFactory = new ManagedTransactionFactory();} else {transactionFactory = new JdbcTransactionFactory();}}}public void initSqlSessionFactory() {if (sqlSessionFactory == null) {InputStream inputStream = null;try {inputStream = getMyBatisXmlConfigurationStream();Environment environment = new Environment("default", transactionFactory, dataSource);Reader reader = new InputStreamReader(inputStream);Properties properties = new Properties();properties.put("prefix", databaseTablePrefix);String wildcardEscapeClause = "";if ((databaseWildcardEscapeCharacter != null) && (databaseWildcardEscapeCharacter.length() != 0)) {wildcardEscapeClause = " escape '" + databaseWildcardEscapeCharacter + "'";}properties.put("wildcardEscapeClause", wildcardEscapeClause);//set default propertiesproperties.put("limitBefore" , "");properties.put("limitAfter" , "");properties.put("limitBetween" , "");properties.put("limitOuterJoinBetween" , "");properties.put("limitBeforeNativeQuery" , "");properties.put("orderBy" , "order by ${orderByColumns}");properties.put("blobType" , "BLOB");properties.put("boolValue" , "TRUE");if (databaseType != null) {properties.load(getResourceAsStream("org/activiti/db/properties/"+databaseType+".properties"));}Configuration configuration = initMybatisConfiguration(environment, reader, properties);sqlSessionFactory = new DefaultSqlSessionFactory(configuration);} catch (Exception e) {throw new ActivitiException("Error while building ibatis SqlSessionFactory: " + e.getMessage(), e);} finally {IoUtil.closeSilently(inputStream);}}}

数据源相关

Mybatis SqlSessionFactoryTransactionFactory、 datasource 构建过程:
transactionFactory+dataSource -》Environment+properties -》Configuration-》SqlSessionFactory

Activiti DbSqlSession、DbSqlSessionFactory:
SqlSessionFactory -》DbSqlSessionFactory-》DbSqlSession-》Session

initSqlSessionFactory
以下为Activiti 构造 initSqlSessionFactory时,完成Mybatis 的 DefaultSqlSessionFactory的过程。

Activiti源码 ProcessEngineConfiguration相关推荐

  1. activiti源码编译

    分享牛原创(尊重原创 转载对的时候第一行请注明,转载出处来自分享牛http://blog.csdn.net/qq_30739519) activiti源码编译,近期有人问activiti 源码编译的一 ...

  2. activiti源码解析重磅来袭

    activiti源码解析视频课程大概80课,会一直更新...,目前录制完毕的视频如下: 第2课:Activiti源码获取以及编译 第3课:流程引擎配置类的作用,配置方式.开关属性技巧.手动构建.Act ...

  3. Activiti源码分析(框架、核心类。。。)

    Activiti源码分析(框架.核心类...) 目录 概 述 activiti源码分析(一)设计模式 总结: 相关工具如下: 分析: 小结: 参考资料和推荐阅读 LD is tigger foreve ...

  4. Activiti源码之建造者模式 Builder

    建造者模式介绍 建造者模式(Builder Pattern)使用多个简单的对象一步一步构建成一个复杂的对象.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. 一个 Builder 类 ...

  5. Activiti源码 之 DataManager EntityManager

    by yan 20211223 阅读了Activiti 相关源码,记录下对DataManager & EntityManager的理解. DataManager 是一层相对底层的抽象,主要负责 ...

  6. Activiti源码解读之TaskService

    activiti-5.17.0源码解读之TaskService 源码路径:activiti-5.17.0\modules\activiti-engine\src\main\java\org\activ ...

  7. activiti源码解析系列8 - 任务完成命令类

    我们在完成任务的时候都执行了哪些操作呢? 主要涉及删除表(默认非级联): ACT_RU_TASK ACT_RU_IDENTITYLINK ACT_RU_VARIABLE 主要看一个CompleteTa ...

  8. activiti源码学习之命令模式

    什么是命令模式? 大都很熟悉的设计模式,此问题不在本文介绍范围内. activiti中的命令模式 activiti使用命令模式作为基础开发模型.把每个操作都封装为一个命令,降低代码的耦合度,避免臃肿的 ...

  9. Activiti源码 之Command与 CommandInterceptor

    by yan 20220228 Activiti 命令拦截器 执行过程 Activiti每发执行一个Command时都会经过一个责任链模式的命令拦截器(采用命令模式实现的拦截器),执行一系列的Comm ...

最新文章

  1. .NET中添加控件数组
  2. 126篇殿堂级深度学习论文分类整理 从入门到应用 | 干货
  3. php service locator,Yii源码解读-服务定位器(ServiceLocator)
  4. py2neo 基本用法
  5. 腾讯微博发表带图片的微博
  6. 【转载】MOS开关(verilog)
  7. 转:RMAN 备份与恢复 实例
  8. extJs相关名字解释
  9. python分为哪几个模块_干货:入门Python重点学哪几个模块才能成为高手?
  10. 要使一个问题能够用计算机解决,如何正确并解决在使用计算机中的问题?
  11. jQuery Mobile中页面page的data-*选项
  12. 随机生成一串字符串(java)
  13. Zabbix3 ——Server端的安装配置小结
  14. 卡巴斯基病毒库离线更新教程(转)
  15. HTML&CSS:制作简易电商网站
  16. Halcon教程十四:训练自己的模型然后识别相似的图像
  17. jrebel离线激活_jrebel激活
  18. 10000+TB 阿里网盘资源!够过年了吧?
  19. mysql 导入dmp_navicat怎么导入dmp文件
  20. Web全栈~28.网络编程

热门文章

  1. android自定义控件实例
  2. TCP/IP协议与Http协议的区别详解
  3. c#中通过截获windows消息禁止改变窗体大小
  4. MFC的来龙去脉-----消息处理,找处理函数
  5. Android USB转串口编程
  6. C语言在计算机专业的功能,C语言程序设计在高职院校计算机专业教学中重要作用.pdf...
  7. java io读取文件夹_JavaIO利用迭代读取文件夹所有目录及文件
  8. tcp 组播_华为组播理论知识详解(二)
  9. php运行汇编,php脚本的执行过程(编译与执行相分离)
  10. ubuntu 20.04 阿里源_Ubuntu 18.04 安装CUDA 更新内核源出错解决方案