MultiThread Connection To Database When Running Migrations. - tsgrp/OpenMigrate GitHub Wiki

Problem:

Currently we are using "org.springframework.jdbc.datasource.SingleConnectionDataSource" when running migrations that require a JDBC connection. This is good for testing but does not help when we want to be performant. It creates a bottle neck and threads wait behind one another.

Solution:

We can use "org.apache.commons.dbcp2.BasicDataSource" This allows us to set the max total number of separate connections we want to allow on the database. this is set by the property maxTotal. An example of a bean is below.

Example:

Look at the sample project "sample-alfresco-to-fs-PUMA" to find the bean example

Dependencies:

The dbcp2 and pooling jars for this bean is committed to the core module.