public static boolean isDuplicateKeyException(final Throwable throwable) {
        // 1062 is a duplicate key exception so someone else has already inserted it
        return NullSafe.test(throwable, e ->
                e instanceof DataAccessException
                && e.getCause() instanceof SQLIntegrityConstraintViolationException sqlEx
                && sqlEx.getErrorCode() == 1062);
    }
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