List of usage examples for org.apache.commons.pool.impl GenericObjectPool GenericObjectPool
public GenericObjectPool()
From source file:net.sf.farrago.namespace.jdbc.MedJdbcDataServer.java
private void initializeDataSource() throws SQLException { assert (!disableConnectionPool); if (jndiName != null) { try {// w w w . ja v a 2 s.c o m // TODO: Allow specification of initial context factory and // provider URL via addition options. These should be stored // in jndiEnv before the initJndi call and the names (keys) of // the those properties would be used in the JndiUtil // constructor. Can also allow artibrary env properties. JndiUtil jndiUtil = new JndiUtil("", Context.INITIAL_CONTEXT_FACTORY, Context.PROVIDER_URL); Properties jndiEnv = new Properties(); jndiUtil.initJndi(jndiEnv); InitialContext initCtx = jndiUtil.newInitialContext(jndiEnv); dataSource = jndiUtil.lookup(initCtx, jndiName, DataSource.class); if (dataSource == null) { throw FarragoResource.instance().MedJdbc_InvalidDataSource.ex(jndiName); } return; } catch (NamingException e) { throw FarragoResource.instance().MedJdbc_InvalidDataSource.ex(jndiName, e); } } String userName = getUserName(); String password = getPassword(); ConnectionFactory connectionFactory; if (connectProps != null) { if (userName != null) { connectProps.setProperty("user", userName); } if (password != null) { connectProps.setProperty("password", password); } connectionFactory = new DriverManagerConnectionFactory(url, connectProps); } else if (userName == null) { connectionFactory = new DriverManagerConnectionFactory(url, new Properties()); } else { if (password == null) { password = ""; } connectionFactory = new DriverManagerConnectionFactory(url, userName, password); } if (validateWhileIdle && (evictionTimerPeriodMillis <= 0L)) { logger.warning("Request to validate on idle ignored: property " + PROP_EVICTION_TIMER_PERIOD_MILLIS + " must be > 0"); if ((validationQuery != null) && !validateOnBorrow && !validateOnReturn) { validateOnBorrow = true; logger.warning("Enabling validation on request"); } } connectionPool = new GenericObjectPool(); connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW); connectionPool.setMaxActive(-1); connectionPool.setTestOnBorrow(validateOnBorrow); connectionPool.setTestOnReturn(validateOnReturn); connectionPool.setTestWhileIdle(validateWhileIdle); connectionPool.setMaxIdle(maxIdleConnections); connectionPool.setTimeBetweenEvictionRunsMillis(evictionTimerPeriodMillis); connectionPool.setMinEvictableIdleTimeMillis(minEvictionIdleMillis); CustomPoolableConnectionFactory poolableConnectionFactory = new CustomPoolableConnectionFactory( connectionFactory, connectionPool, validationQuery, autocommit, null); connectionPool.setFactory(poolableConnectionFactory); PoolingDataSource pds = new PoolingDataSource(connectionPool); pds.setAccessToUnderlyingConnectionAllowed(true); dataSource = pds; }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java
public void testSettersAndGetters() throws Exception { GenericObjectPool pool = new GenericObjectPool(); {// www. j a v a 2s . com pool.setFactory(new SimpleFactory()); } { pool.setMaxActive(123); assertEquals(123, pool.getMaxActive()); } { pool.setMaxIdle(12); assertEquals(12, pool.getMaxIdle()); } { pool.setMaxWait(1234L); assertEquals(1234L, pool.getMaxWait()); } { pool.setMinEvictableIdleTimeMillis(12345L); assertEquals(12345L, pool.getMinEvictableIdleTimeMillis()); } { pool.setNumTestsPerEvictionRun(11); assertEquals(11, pool.getNumTestsPerEvictionRun()); } { pool.setTestOnBorrow(true); assertTrue(pool.getTestOnBorrow()); pool.setTestOnBorrow(false); assertTrue(!pool.getTestOnBorrow()); } { pool.setTestOnReturn(true); assertTrue(pool.getTestOnReturn()); pool.setTestOnReturn(false); assertTrue(!pool.getTestOnReturn()); } { pool.setTestWhileIdle(true); assertTrue(pool.getTestWhileIdle()); pool.setTestWhileIdle(false); assertTrue(!pool.getTestWhileIdle()); } { pool.setTimeBetweenEvictionRunsMillis(11235L); assertEquals(11235L, pool.getTimeBetweenEvictionRunsMillis()); } { pool.setSoftMinEvictableIdleTimeMillis(12135L); assertEquals(12135L, pool.getSoftMinEvictableIdleTimeMillis()); } { pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK); assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction()); pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL); assertEquals(GenericObjectPool.WHEN_EXHAUSTED_FAIL, pool.getWhenExhaustedAction()); pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW); assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction()); } }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java
public void testDefaultConfiguration() throws Exception { GenericObjectPool pool = new GenericObjectPool(); assertConfiguration(new GenericObjectPool.Config(), pool); }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java
public void testConstructors() throws Exception { {/*from ww w . j a v a 2 s . c o m*/ GenericObjectPool pool = new GenericObjectPool(); assertConfiguration(new GenericObjectPool.Config(), pool); } { GenericObjectPool pool = new GenericObjectPool(new SimpleFactory()); assertConfiguration(new GenericObjectPool.Config(), pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxIdle = 3; expected.maxWait = 5L; expected.minEvictableIdleTimeMillis = 7L; expected.numTestsPerEvictionRun = 9; expected.testOnBorrow = true; expected.testOnReturn = true; expected.testWhileIdle = true; expected.timeBetweenEvictionRunsMillis = 11L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; GenericObjectPool pool = new GenericObjectPool(null, expected); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxWait = 5L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive, expected.whenExhaustedAction, expected.maxWait); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxWait = 5L; expected.testOnBorrow = true; expected.testOnReturn = true; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.testOnBorrow, expected.testOnReturn); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxIdle = 3; expected.maxWait = 5L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxIdle = 3; expected.maxWait = 5L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; expected.testOnBorrow = true; expected.testOnReturn = true; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.testOnBorrow, expected.testOnReturn); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxIdle = 3; expected.maxWait = 5L; expected.minEvictableIdleTimeMillis = 7L; expected.numTestsPerEvictionRun = 9; expected.testOnBorrow = true; expected.testOnReturn = true; expected.testWhileIdle = true; expected.timeBetweenEvictionRunsMillis = 11L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle); assertConfiguration(expected, pool); } { GenericObjectPool.Config expected = new GenericObjectPool.Config(); expected.maxActive = 2; expected.maxIdle = 3; expected.minIdle = 1; expected.maxWait = 5L; expected.minEvictableIdleTimeMillis = 7L; expected.numTestsPerEvictionRun = 9; expected.testOnBorrow = true; expected.testOnReturn = true; expected.testWhileIdle = true; expected.timeBetweenEvictionRunsMillis = 11L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; GenericObjectPool pool = new GenericObjectPool(null, expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.minIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle); assertConfiguration(expected, pool); } }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java
public void testSetConfig() throws Exception { GenericObjectPool.Config expected = new GenericObjectPool.Config(); GenericObjectPool pool = new GenericObjectPool(); assertConfiguration(expected, pool); expected.maxActive = 2;// w ww.j a v a 2 s . co m expected.maxIdle = 3; expected.maxWait = 5L; expected.minEvictableIdleTimeMillis = 7L; expected.numTestsPerEvictionRun = 9; expected.testOnBorrow = true; expected.testOnReturn = true; expected.testWhileIdle = true; expected.timeBetweenEvictionRunsMillis = 11L; expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; pool.setConfig(expected); assertConfiguration(expected, pool); }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java
public void testAddObject() throws Exception { assertEquals("should be zero idle", 0, pool.getNumIdle()); pool.addObject();// w ww . j a v a2 s . c o m assertEquals("should be one idle", 1, pool.getNumIdle()); assertEquals("should be zero active", 0, pool.getNumActive()); Object obj = pool.borrowObject(); assertEquals("should be zero idle", 0, pool.getNumIdle()); assertEquals("should be one active", 1, pool.getNumActive()); pool.returnObject(obj); assertEquals("should be one idle", 1, pool.getNumIdle()); assertEquals("should be zero active", 0, pool.getNumActive()); ObjectPool op = new GenericObjectPool(); try { op.addObject(); fail("Expected IllegalStateException when there is no factory."); } catch (IllegalStateException ise) { // expected } op.close(); }
From source file:ojw28.orm.utils.DbConnectionPool.java
private void createPool() throws Exception { mPool = new GenericObjectPool(); Properties props = new Properties(); props.setProperty("user", "orm"); props.setProperty("password", "openroommap"); ConnectionFactory cf = new DriverConnectionFactory(new org.postgresql.Driver(), "jdbc:postgresql://localhost:5432/openroommap", props); KeyedObjectPoolFactory kopf = new GenericKeyedObjectPoolFactory(null, 10); new PoolableConnectionFactory(cf, mPool, kopf, null, false, false); for (int i = 0; i < 5; i++) { mPool.addObject();/* w ww.ja va2 s .c o m*/ } // PoolingDataSource pds = new PoolingDataSource(gPool); PoolingDriver pd = new PoolingDriver(); pd.registerPool("openroommap", mPool); for (int i = 0; i < 5; i++) { mPool.addObject(); } mLogger.info("Created connection pool"); mLogger.info("Active\t" + mPool.getNumActive() + "\tIdle\t" + mPool.getNumIdle()); }
From source file:org.aitools.programd.Core.java
/** * Returns a database connection backed by a pooling driver. * This is initialized lazily, since some people may not be * using any database-based features./* w w w.j a v a 2s .c o m*/ * * @return a dbmanager */ public Connection getDBConnection() { if (this._connectionPool == null) { try { Class.forName(this._settings.getDatabaseDriver()); } catch (ClassNotFoundException e) { throw new UserError("Could not find your database driver.", e); } this._connectionPool = new GenericObjectPool(); ConnectionFactory connectionFactory = new DriverManagerConnectionFactory( this._settings.getDatabaseURL(), this._settings.getDatabaseUsername(), this._settings.getDatabasePassword()); new PoolableConnectionFactory(connectionFactory, this._connectionPool, null, null, false, true); PoolingDriver driver = new PoolingDriver(); driver.registerPool("programd", this._connectionPool); } try { return DriverManager.getConnection("jdbc:apache:commons:dbcp:programd"); } catch (SQLException e) { this._logger.error("SQL exception when getting a db connection.", e); return null; } }
From source file:org.apache.flume.channel.jdbc.impl.JdbcChannelProviderImpl.java
/** //from w w w . j ava 2 s .c om * Initializes the datasource and the underlying connection pool. * @param properties */ private void initializeDataSource(Context context) { driverClassName = getConfigurationString(context, ConfigurationConstants.CONFIG_JDBC_DRIVER_CLASS, ConfigurationConstants.OLD_CONFIG_JDBC_DRIVER_CLASS, null); connectUrl = getConfigurationString(context, ConfigurationConstants.CONFIG_URL, ConfigurationConstants.OLD_CONFIG_URL, null); String userName = getConfigurationString(context, ConfigurationConstants.CONFIG_USERNAME, ConfigurationConstants.OLD_CONFIG_USERNAME, null); String password = getConfigurationString(context, ConfigurationConstants.CONFIG_PASSWORD, ConfigurationConstants.OLD_CONFIG_PASSWORD, null); String jdbcPropertiesFile = getConfigurationString(context, ConfigurationConstants.CONFIG_JDBC_PROPS_FILE, ConfigurationConstants.OLD_CONFIG_JDBC_PROPS_FILE, null); String dbTypeName = getConfigurationString(context, ConfigurationConstants.CONFIG_DATABASE_TYPE, ConfigurationConstants.OLD_CONFIG_DATABASE_TYPE, null); // If connect URL is not specified, use embedded Derby if (connectUrl == null || connectUrl.trim().length() == 0) { LOGGER.warn("No connection URL specified. " + "Using embedded derby database instance."); driverClassName = DEFAULT_DRIVER_CLASSNAME; userName = DEFAULT_USERNAME; password = DEFAULT_PASSWORD; dbTypeName = DEFAULT_DBTYPE; String homePath = System.getProperty("user.home").replace('\\', '/'); String defaultDbDir = homePath + "/.flume/jdbc-channel"; File dbDir = new File(defaultDbDir); String canonicalDbDirPath = null; try { canonicalDbDirPath = dbDir.getCanonicalPath(); } catch (IOException ex) { throw new JdbcChannelException("Unable to find canonical path of dir: " + defaultDbDir, ex); } if (!dbDir.exists()) { if (!dbDir.mkdirs()) { throw new JdbcChannelException("unable to create directory: " + canonicalDbDirPath); } } connectUrl = "jdbc:derby:" + canonicalDbDirPath + "/db;create=true"; // No jdbc properties file will be used jdbcPropertiesFile = null; LOGGER.warn("Overriding values for - driver: " + driverClassName + ", user: " + userName + "connectUrl: " + connectUrl + ", jdbc properties file: " + jdbcPropertiesFile + ", dbtype: " + dbTypeName); } // Right now only Derby and MySQL supported databaseType = DatabaseType.getByName(dbTypeName); switch (databaseType) { case DERBY: case MYSQL: break; default: throw new JdbcChannelException("Database " + databaseType + " not supported at this time"); } // Register driver if (driverClassName == null || driverClassName.trim().length() == 0) { throw new JdbcChannelException("No jdbc driver specified"); } try { Class.forName(driverClassName); } catch (ClassNotFoundException ex) { throw new JdbcChannelException("Unable to load driver: " + driverClassName, ex); } // JDBC Properties Properties jdbcProps = new Properties(); if (jdbcPropertiesFile != null && jdbcPropertiesFile.trim().length() > 0) { File jdbcPropsFile = new File(jdbcPropertiesFile.trim()); if (!jdbcPropsFile.exists()) { throw new JdbcChannelException("Jdbc properties file does not exist: " + jdbcPropertiesFile); } InputStream inStream = null; try { inStream = new FileInputStream(jdbcPropsFile); jdbcProps.load(inStream); } catch (IOException ex) { throw new JdbcChannelException( "Unable to load jdbc properties " + "from file: " + jdbcPropertiesFile, ex); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException ex) { LOGGER.error("Unable to close file: " + jdbcPropertiesFile, ex); } } } } if (userName != null) { Object oldUser = jdbcProps.put("user", userName); if (oldUser != null) { LOGGER.warn("Overriding user from: " + oldUser + " to: " + userName); } } if (password != null) { Object oldPass = jdbcProps.put("password", password); if (oldPass != null) { LOGGER.warn( "Overriding password from the jdbc properties with " + " the one specified explicitly."); } } if (LOGGER.isDebugEnabled()) { StringBuilder sb = new StringBuilder("JDBC Properties {"); boolean first = true; Enumeration<?> propertyKeys = jdbcProps.propertyNames(); while (propertyKeys.hasMoreElements()) { if (first) { first = false; } else { sb.append(", "); } String key = (String) propertyKeys.nextElement(); sb.append(key).append("="); if (key.equalsIgnoreCase("password")) { sb.append("*******"); } else { sb.append(jdbcProps.get(key)); } } sb.append("}"); LOGGER.debug(sb.toString()); } // Transaction Isolation String txIsolation = getConfigurationString(context, ConfigurationConstants.CONFIG_TX_ISOLATION_LEVEL, ConfigurationConstants.OLD_CONFIG_TX_ISOLATION_LEVEL, TransactionIsolation.READ_COMMITTED.getName()); TransactionIsolation txIsolationLevel = TransactionIsolation.getByName(txIsolation); LOGGER.debug("Transaction isolation will be set to: " + txIsolationLevel); // Setup Datasource ConnectionFactory connFactory = new DriverManagerConnectionFactory(connectUrl, jdbcProps); connectionPool = new GenericObjectPool(); String maxActiveConnections = getConfigurationString(context, ConfigurationConstants.CONFIG_MAX_CONNECTIONS, ConfigurationConstants.OLD_CONFIG_MAX_CONNECTIONS, "10"); int maxActive = 10; if (maxActiveConnections != null && maxActiveConnections.length() > 0) { try { maxActive = Integer.parseInt(maxActiveConnections); } catch (NumberFormatException nfe) { LOGGER.warn("Max active connections has invalid value: " + maxActiveConnections + ", Using default: " + maxActive); } } LOGGER.debug("Max active connections for the pool: " + maxActive); connectionPool.setMaxActive(maxActive); statementPool = new GenericKeyedObjectPoolFactory(null); // Creating the factory instance automatically wires the connection pool new PoolableConnectionFactory(connFactory, connectionPool, statementPool, databaseType.getValidationQuery(), false, false, txIsolationLevel.getCode()); dataSource = new PoolingDataSource(connectionPool); txFactory = new JdbcTransactionFactory(dataSource, this); }
From source file:org.apache.hadoop.hive.metastore.datasource.DbCPDataSourceProvider.java
@Override public DataSource create(Configuration hdpConfig) throws SQLException { LOG.debug("Creating dbcp connection pool for the MetaStore"); String driverUrl = DataSourceProvider.getMetastoreJdbcDriverUrl(hdpConfig); String user = DataSourceProvider.getMetastoreJdbcUser(hdpConfig); String passwd = DataSourceProvider.getMetastoreJdbcPasswd(hdpConfig); int maxPoolSize = hdpConfig.getInt(MetastoreConf.ConfVars.CONNECTION_POOLING_MAX_CONNECTIONS.getVarname(), ((Long) MetastoreConf.ConfVars.CONNECTION_POOLING_MAX_CONNECTIONS.getDefaultVal()).intValue()); long connectionTimeout = hdpConfig.getLong(CONNECTION_TIMEOUT_PROPERTY, 30000L); int connectionMaxIlde = hdpConfig.getInt(CONNECTION_MAX_IDLE_PROPERTY, GenericObjectPool.DEFAULT_MAX_IDLE); int connectionMinIlde = hdpConfig.getInt(CONNECTION_MIN_IDLE_PROPERTY, GenericObjectPool.DEFAULT_MIN_IDLE); boolean testOnBorrow = hdpConfig.getBoolean(CONNECTION_TEST_BORROW_PROPERTY, GenericObjectPool.DEFAULT_TEST_ON_BORROW); long evictionTimeMillis = hdpConfig.getLong(CONNECTION_MIN_EVICT_MILLIS_PROPERTY, GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS); boolean testWhileIdle = hdpConfig.getBoolean(CONNECTION_TEST_IDLEPROPERTY, GenericObjectPool.DEFAULT_TEST_WHILE_IDLE); long timeBetweenEvictionRuns = hdpConfig.getLong(CONNECTION_TIME_BETWEEN_EVICTION_RUNS_MILLIS, GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS); int numTestsPerEvictionRun = hdpConfig.getInt(CONNECTION_NUM_TESTS_PER_EVICTION_RUN, GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN); boolean testOnReturn = hdpConfig.getBoolean(CONNECTION_TEST_ON_RETURN, GenericObjectPool.DEFAULT_TEST_ON_RETURN); long softMinEvictableIdleTimeMillis = hdpConfig.getLong(CONNECTION_SOFT_MIN_EVICTABLE_IDLE_TIME, GenericObjectPool.DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS); boolean lifo = hdpConfig.getBoolean(CONNECTION_LIFO, GenericObjectPool.DEFAULT_LIFO); GenericObjectPool objectPool = new GenericObjectPool(); objectPool.setMaxActive(maxPoolSize); objectPool.setMaxWait(connectionTimeout); objectPool.setMaxIdle(connectionMaxIlde); objectPool.setMinIdle(connectionMinIlde); objectPool.setTestOnBorrow(testOnBorrow); objectPool.setTestWhileIdle(testWhileIdle); objectPool.setMinEvictableIdleTimeMillis(evictionTimeMillis); objectPool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRuns); objectPool.setNumTestsPerEvictionRun(numTestsPerEvictionRun); objectPool.setTestOnReturn(testOnReturn); objectPool.setSoftMinEvictableIdleTimeMillis(softMinEvictableIdleTimeMillis); objectPool.setLifo(lifo);// w w w.j a v a 2 s.com ConnectionFactory connFactory = new DriverManagerConnectionFactory(driverUrl, user, passwd); // This doesn't get used, but it's still necessary, see // https://git1-us-west.apache.org/repos/asf?p=commons-dbcp.git;a=blob;f=doc/ManualPoolingDataSourceExample.java; // h=f45af2b8481f030b27364e505984c0eef4f35cdb;hb=refs/heads/DBCP_1_5_x_BRANCH new PoolableConnectionFactory(connFactory, objectPool, null, null, false, true); return new PoolingDataSource(objectPool); }