public static DataSourceProvider tryGetDataSourceProviderOrNull(Configuration hdpConfig) {
    final String configuredPoolingType = MetastoreConf.getVar(hdpConfig,
        MetastoreConf.ConfVars.CONNECTION_POOLING_TYPE);
    return Iterables.tryFind(FACTORIES, factory -> {
      String poolingType = factory.getPoolingType();
      return poolingType != null && poolingType.equalsIgnoreCase(configuredPoolingType);
    }).orNull();
  }
@Test
  public void testSetHikariCpLeakDetectionThresholdProperty() throws SQLException {

    MetastoreConf.setVar(conf, ConfVars.CONNECTION_POOLING_TYPE, HikariCPDataSourceProvider.HIKARI);
    conf.set(HikariCPDataSourceProvider.HIKARI + ".leakDetectionThreshold", "3600");
    conf.set(HikariCPDataSourceProvider.HIKARI + ".initializationFailTimeout", "-1");

    DataSourceProvider dsp = DataSourceProviderFactory.tryGetDataSourceProviderOrNull(conf);
    Assert.assertNotNull(dsp);

    DataSource ds = dsp.create(conf);
    Assert.assertTrue(ds instanceof HikariDataSource);
    Assert.assertEquals(3600L, ((HikariDataSource)ds).getLeakDetectionThreshold());
  }