Package org.apache.commons.pool

Examples of org.apache.commons.pool.KeyedObjectPoolFactory


      //create a new data source based on the database connection info provided.
      ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
          url, username, password)
      GenericObjectPool connectionPool = new GenericObjectPool();
      KeyedObjectPoolFactory stmtPool = new GenericKeyedObjectPoolFactory(null);
      new PoolableConnectionFactory(
          connectionFactory, connectionPool, stmtPool, null, false, true);
      DataSource dataSource = new PoolingDataSource(connectionPool);

      //test the connection (this will throw an exception if the connection is faulty)
View Full Code Here


                    cloudMaxWait, cloudMaxIdle, cloudTestOnBorrow, false, cloudTimeBtwEvictionRunsMillis, 1, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle);

            final ConnectionFactory cloudConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://" + cloudHost + ":" + cloudPort + "/" + cloudDbName +
                    "?autoReconnect=" + cloudAutoReconnect + (url != null ? "&" + url : "") + (useSSL ? "&useSSL=true" : ""), cloudUsername, cloudPassword);

            final KeyedObjectPoolFactory poolableObjFactory = (cloudPoolPreparedStatements ? new StackKeyedObjectPoolFactory() : null);

            final PoolableConnectionFactory cloudPoolableConnectionFactory = new PoolableConnectionFactory(cloudConnectionFactory, cloudConnectionPool, poolableObjFactory,
                    cloudValidationQuery, false, false, isolationLevel);

            // Default Data Source for CloudStack
View Full Code Here

    private ObjectPool createConnectionPool() {

        ConnectionFactory factory = createConnectionFactory();
        GenericObjectPool.Config poolConfig = createConnectionPoolConfig();
        KeyedObjectPoolFactory statementPool = createPreparedStatementPool();

        String validationQuery = config.getString(VALIDATION_QUERY);
        boolean defaultReadOnly = config.getBoolean(READ_ONLY, false);
        boolean defaultAutoCommit = config.getBoolean(AUTO_COMMIT, false);
        int defaultTransactionIsolation = config.getTransactionIsolation(
View Full Code Here

        new TesterDriver();
        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                "jdbc:apache:commons:testdriver","u1","p1");

        ObjectPool connPool = new GenericObjectPool();
        KeyedObjectPoolFactory stmtPoolFactory = new GenericKeyedObjectPoolFactory(null);

        PoolableConnectionFactory x = new PoolableConnectionFactory(
                connFactory, connPool, stmtPoolFactory,
                null, false, true);
View Full Code Here

    private ObjectPool createConnectionPool() {

        ConnectionFactory factory = createConnectionFactory();
        GenericObjectPool.Config poolConfig = createConnectionPoolConfig();
        KeyedObjectPoolFactory statementPool = createPreparedStatementPool();

        String validationQuery = config.getString(VALIDATION_QUERY);
        boolean defaultReadOnly = config.getBoolean(READ_ONLY, false);
        boolean defaultAutoCommit = config.getBoolean(AUTO_COMMIT, false);
        int defaultTransactionIsolation = config.getTransactionIsolation(
View Full Code Here

        new TesterDriver();
        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                "jdbc:apache:commons:testdriver","u1","p1");

        ObjectPool connPool = new GenericObjectPool();
        KeyedObjectPoolFactory stmtPoolFactory = new GenericKeyedObjectPoolFactory(null);

        new PoolableConnectionFactory(connFactory, connPool, stmtPoolFactory,
                null, false, true);

        DataSource ds = new PoolingDataSource(connPool);
View Full Code Here

        new TesterDriver();
        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                "jdbc:apache:commons:testdriver","u1","p1");

        ObjectPool connPool = new GenericObjectPool();
        KeyedObjectPoolFactory stmtPoolFactory = new GenericKeyedObjectPoolFactory(null);

        new PoolableConnectionFactory(connFactory, connPool, stmtPoolFactory,
                null, false, true);

        DataSource ds = new PoolingDataSource(connPool);
View Full Code Here

        new TesterDriver();
        ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                "jdbc:apache:commons:testdriver","u1","p1");

        ObjectPool connPool = new GenericObjectPool();
        KeyedObjectPoolFactory stmtPoolFactory = new GenericKeyedObjectPoolFactory(null);

        new PoolableConnectionFactory(connFactory, connPool, stmtPoolFactory,
                null, false, true);

        DataSource ds = new PoolingDataSource(connPool);
View Full Code Here

        // the connectionPool will use to create Connection instances
        final org.apache.commons.dbcp.ConnectionFactory connectionFactory;
        connectionFactory = createConnectionFactory(jcd);

        // Create PreparedStatement object pool (if any)
        KeyedObjectPoolFactory statementPoolFactory = createStatementPoolFactory(jcd);

        // Set validation query and auto-commit mode
        final String validationQuery;
        final boolean defaultAutoCommit;
        final boolean defaultReadOnly = false;
View Full Code Here

      boolean defaultAutoCommit =
          attributes.containsKey( IDBDatasourceService.DEFAULT_AUTO_COMMIT ) ? Boolean.parseBoolean( attributes
              .get( IDBDatasourceService.DEFAULT_AUTO_COMMIT ) ) : true; // default to true

      KeyedObjectPoolFactory kopf = null;

      if ( attributes.containsKey( IDBDatasourceService.POOL_PREPARED_STATEMENTS )
          && true == Boolean.parseBoolean( attributes.get( IDBDatasourceService.POOL_PREPARED_STATEMENTS ) ) ) {

        int maxOpenPreparedStatements = -1; // unlimited
View Full Code Here

TOP

Related Classes of org.apache.commons.pool.KeyedObjectPoolFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.