@Override
    public Connection getConnection(String username, String password) throws SQLException {
        semaphore.acquireUninterruptibly();
        Connection connection = delegate.getConnection(username, password);
        return new BlockingConnectionWrapper(connection, semaphore);
    }
Blocking data source wrapper that should avoid to exhaustion of database connections.
It is a better choice than using a connection pool because database connections can be released as soon as possible.
embedded-database-spring-test/src/main/java/io/zonky/test/db/provider/support/BlockingDatabaseWrapper.java