public static void setupUCP(
      final int pAbandonedConnectionTimeOut,
      final String pConnectionFactoryClassName,
      final String pConnectionPoolName,
      final String pUrl,
      final int pInitialPoolSize,
      final int pMaxCachedStatements)
      throws UniversalConnectionPoolException, SQLException {
    LOGGER.info("Setup invoked");

    ucpPoolMgr = UniversalConnectionPoolManagerMBeanImpl.getUniversalConnectionPoolManagerMBean();

    LOGGER.info("UniversalConnectionPoolManagerMBeanImpl instance retrieved");

    ucpDataSource = PoolDataSourceFactory.getPoolDataSource();

    LOGGER.info("UCP pool datasource retrieved");

    ucpDataSource.setConnectionFactoryClassName(pConnectionFactoryClassName);

    LOGGER.info("UCP Connection factory class name set -> {}", pConnectionFactoryClassName);

    ucpDataSource.setConnectionPoolName(pConnectionPoolName);

    LOGGER.info("UCP pool name set -> {}", pConnectionPoolName);

    ucpDataSource.setURL(pUrl);

    LOGGER.info("UCP Url set -> {}", pUrl);

    if (pInitialPoolSize > 0) {
      ucpDataSource.setInitialPoolSize(pInitialPoolSize);

      LOGGER.info("UCP Initial Pool Size set -> {}", pInitialPoolSize);
    }

    ucpDataSource.setMaxStatements(pMaxCachedStatements);

    LOGGER.info("UCP Maximum cached statements set -> {}", pMaxCachedStatements);

    if (pAbandonedConnectionTimeOut >= 0) {
      ucpDataSource.setAbandonedConnectionTimeout(pAbandonedConnectionTimeOut);

      LOGGER.info("UCP abandoned connection timeout set -> {}", pAbandonedConnectionTimeOut);
    }

    ucpPoolMgr.createConnectionPool((UniversalConnectionPoolAdapter) ucpDataSource);

    LOGGER.info("UCP pool created");

    ucpDataSource.registerConnectionLabelingCallback(new UCPConnectionLabellingCallback());

    LOGGER.info("Connection Labelling Callback handler registered");
  }
 /**
  * Initialize OracleDataSource manually because datasource property
  * spring.datasource.type=oracle.jdbc.pool.OracleDataSource is not correctly handled by spring
  * https://github.com/spring-projects/spring-boot/issues/6027#issuecomment-221582708
  *
  * @param properties
  * @return
  * @throws SQLException
  */
 @Bean
 public DataSource dataSource(final DataSourceProperties properties) throws SQLException {
   final PoolDataSource dataSource = PoolDataSourceFactory.getPoolDataSource();
   dataSource.setUser(properties.getUsername());
   dataSource.setPassword(properties.getPassword());
   dataSource.setURL(properties.getUrl());
   dataSource.setFastConnectionFailoverEnabled(true);
   dataSource.setMaxPoolSize(20);
   dataSource.setMinPoolSize(5);
   dataSource.setMaxIdleTime(5);
   dataSource.setValidateConnectionOnBorrow(true);
   dataSource.setMaxStatements(10);
   dataSource.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
   return dataSource;
 }