class RetryingConnectionFactory implements ConnectionFactory {

    @Override
    public Connection openConnection(JdbcIdentity identity)
            throws SQLException
    {
        try {
            return Failsafe.with(RETRY_POLICY)
                    .get(() -> delegate.openConnection(identity));
        }
        catch (FailsafeException ex) {
            if (ex.getCause() instanceof SQLException) {
                throw (SQLException) ex.getCause();
            }
            throw ex;
        }
    }

    public  RetryingConnectionFactory(ConnectionFactory delegate);

}