Flowable Connection over HikariCP

Right now I use HikariCP to connect the Flowable engine and set it up. I have a point in my system where I spin up a bunch of async jobs to fire off, because it’s efficient that way to just schedule them all and let Flowable figure out when/how to process them. It also had the advantage of not firing off 200+ requests at Flowable rapid-fire, but instead letting them stew in the background and returning control back to the system to move along while that functions.

Here’s comes the fun part. There’s an intermittent resource leak issue that seems to pop up with this part of the async system at times, particularly under heavy load. I confirmed this by turning on the leak detection in HikariCP and it tripped repeatedly. Further research seems to indicate that when using HikariCP with Spring and/or Hibernate, there can be a situation where idle connections are held onto for an inordinate amount of time by default (something like 30+ seconds before being released). Is there a way to inform Flowable to release idle connections quicker and override the default connection settings? Right now, here’s how I set up my Flowable connection:

ProcessEngineConfiguration processEngineConfig = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
DataLogging.connectToDatabase(driverType, jdbcUrl, username, password, idleTimeout, minPoolsize, minIdleConn, prepareCacheStatement, cacheSize, cacheLimit, readOnly);

DataLogging.buildLoggingOutput(logFilePath, verboseLogging);

	processEngineConfig.setDatabaseSchemaUpdate(AbstractEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

processEngineConfig.setDatabaseType(AbstractEngineConfiguration.DATABASE_TYPE_ORACLE);
processEngineConfig.setDataSource(DataLogging.getDatasource());
processEngineConfig.setAsyncExecutorActivate(true);

addCustomJobs(processEngineConfig);

processEngine = processEngineConfig.buildProcessEngine();

ProcessEngine engine = config.buildProcessEngine();

For reference on the DataSource class, here’s what the code that sets up that HikariCP datasource looks like:

HikariConfig dsConfig = new HikariConfig();
dsConfig.setDriverClassName(driverType);
dsConfig.setJdbcUrl(jdbcUrl);
dsConfig.setUsername(username);
dsConfig.setPassword(password);
dsConfig.setIdleTimeout(idleTimeout);
dsConfig.setMaximumPoolSize(minPoolsize);
dsConfig.setMinimumIdle(minIdleConn);
dsConfig.addDataSourceProperty(“cachePrepStmts”, prepareCacheStatement);
dsConfig.addDataSourceProperty(“prepStmtCacheSize”, cacheSize);
dsConfig.addDataSourceProperty(“prepStmtCacheSqlLimit”, cacheLimit);
dsConfig.setReadOnly(readOnly);
dsConfig.setLeakDetectionThreshold(25000);
datasource = new HikariDataSource(dsConfig);