1、如果activiti的ProcessEngineConfiguration通过手动配置数据连接参数的话,最大连接数、最大空闲连接数、JdbcPingEnabled、JdbcPingConnectionNotUsedFor等参数没配的话,很有可能导致数据库连接超时后没可用连接,使程序出现异常,如下为解决超时的配置:
ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setJdbcDriver(getValue("jdbc.driver"))
.setJdbcUrl(getValue("jdbc.url"))
.setJdbcUsername(getValue("jdbc.username"))
.setJdbcPassword(getValue("jdbc.password"))
.setJdbcMaxActiveConnections(200)
.setJdbcMaxIdleConnections(20)
.setJdbcMaxCheckoutTime(20000)
.setJdbcPingEnabled(true)
.setJdbcPingConnectionNotUsedFor(3600*1000)
.setJobExecutorActivate(false)
.buildProcessEngine();
MaxActiveConnections:最大连接数
MaxIdleConnections:最大空闲连接数
MaxCheckoutTime:连接检查时间
JdbcPingEnabled:连接无用后,是否主动连接
JdbcPingConnectionNotUsedFor:连接无用检查并连接间隔,单位毫秒
打个养成读书习惯的广告,扫二维码可以免费领取月卡: