private static void checkDataSource(final DataSource dataSource) {
        DataSource currentDataSource = DATA_SOURCE_THREAD_LOCAL.get();
        if (currentDataSource != null && currentDataSource.equals(dataSource)) {
            try {
                throw new RuntimeException("Data source already in use");
            } catch (final RuntimeException e) {
                LOGGER.error(e::getMessage, e);
            }
        }
        DATA_SOURCE_THREAD_LOCAL.set(dataSource);
    }
Check that the datasource is not currently being used by the current thread. The main point of this check is to
ensure that operations on a datasource are not nested as this can lead to exhaustion of connections from a
datasource connection pool and produce a deadlock. It is generally ok for separate threads to get connections
from the datasource as a connection should become available once one thread has released a connection back to the
pool. However, nested calls, particularly recursive ones, will quickly starve a connection pool and lock the
system.

@param dataSource The datasource to check.
stroom-db-util/src/main/java/stroom/db/util/JooqUtil.java