Package com.jolbox.bonecp

Examples of com.jolbox.bonecp.BoneCPDataSource


            config.setMaxConnectionsPerPartition(20);
            config.setMinConnectionsPerPartition(1);
            config.setConnectionTimeoutInMs(2000);
            config.setInitSQL("set search_path to monitor_data, monitor_api, public");

            pgObserverDatasource = new BoneCPDataSource(config);

            try {

                // check if we can connect to our database
                @SuppressWarnings("unused")
View Full Code Here


    @Resource
    private Environment env;

    @Bean
    public DataSource dataSource() {
        BoneCPDataSource dataSource = new BoneCPDataSource();

        dataSource.setDriverClass(env.getRequiredProperty(PROPERTY_NAME_DATABASE_DRIVER));
        dataSource.setJdbcUrl(env.getRequiredProperty(PROPERTY_NAME_DATABASE_URL));
        dataSource.setUsername(env.getRequiredProperty(PROPERTY_NAME_DATABASE_USERNAME));
        dataSource.setPassword(env.getRequiredProperty(PROPERTY_NAME_DATABASE_PASSWORD));

        return dataSource;
    }
View Full Code Here

     * @param passwd      사용자 패스워드
     * @return [[javax.sql.DataSource]] 인스턴스
     */
    public static DataSource getBoneCPDataSource(String driverClass, String url, String username, String passwd) {

        BoneCPDataSource ds = new BoneCPDataSource();
        ds.setDriverClass(driverClass);
        ds.setJdbcUrl(url);
        ds.setUser(username);
        ds.setPassword(passwd);

        int processCount = Runtime.getRuntime().availableProcessors();

        ds.setMaxConnectionsPerPartition(100);
        ds.setMinConnectionsPerPartition(processCount);
        ds.setPartitionCount(4);

        ds.setIdleMaxAgeInSeconds(120);
        ds.setIdleConnectionTestPeriodInSeconds(60);
        ds.setMaxConnectionAgeInSeconds(300);

        ds.setDisableJMX(true);

        return ds;
    }
View Full Code Here

        System.out.println();
    }

    // 当testOnBorrow为true时,BoneCP的处理策略不一样,所以略过
    public void f_test_2() throws Exception {
        BoneCPDataSource dataSource = new BoneCPDataSource();
        // dataSource.(10);
        // dataSource.setMaxActive(50);
        dataSource.setMinConnectionsPerPartition(minPoolSize);
        dataSource.setMaxConnectionsPerPartition(maxPoolSize);

        dataSource.setDriverClass(driverClass);
        dataSource.setJdbcUrl(jdbcUrl);
        dataSource.setStatementsCacheSize(100);
        // dataSource.setMaxOpenPreparedStatements(100);
        dataSource.setUsername(user);
        dataSource.setPassword(password);
        dataSource.setConnectionTestStatement("SELECT 1");
        dataSource.setPartitionCount(1);
        dataSource.setAcquireIncrement(5);
        dataSource.setIdleConnectionTestPeriod(0L);
        // dataSource.setDisableConnectionTracking(true);

        for (int i = 0; i < executeCount; ++i) {
            p0(dataSource, "boneCP", threadCount);
        }
View Full Code Here

        }
        System.out.println();
    }

    public void test_2() throws Exception {
        BoneCPDataSource dataSource = new BoneCPDataSource();
        // dataSource.(10);
        // dataSource.setMaxActive(50);
        dataSource.setMinConnectionsPerPartition(minPoolSize);
        dataSource.setMaxConnectionsPerPartition(maxPoolSize);

        dataSource.setDriverClass(driverClass);
        dataSource.setJdbcUrl(jdbcUrl);
        // dataSource.setPoolPreparedStatements(true);
        // dataSource.setMaxOpenPreparedStatements(100);
        dataSource.setUsername(user);
        dataSource.setPassword(password);
        dataSource.setConnectionTestStatement(validationQuery);
        dataSource.setPartitionCount(1);

        for (int i = 0; i < LOOP_COUNT; ++i) {
            p0(dataSource, "boneCP");
        }
        System.out.println();
View Full Code Here

            // boneCP();
        }
    }

    public void boneCP() throws Exception {
        BoneCPDataSource dataSource = new BoneCPDataSource();
        // dataSource.(10);
        // dataSource.setMaxActive(50);
        dataSource.setMinConnectionsPerPartition(minIdle);
        dataSource.setMaxConnectionsPerPartition(maxIdle);

        dataSource.setDriverClass(driverClass);
        dataSource.setJdbcUrl(jdbcUrl);
        // dataSource.setPoolPreparedStatements(true);
        // dataSource.setMaxOpenPreparedStatements(100);
        dataSource.setUsername(user);
        dataSource.setPassword(password);
        dataSource.setConnectionTestStatement(validationQuery);
        dataSource.setPartitionCount(1);
        Properties connectionProperties = new Properties();
        connectionProperties.put("connectSleep", "3");
        connectionProperties.put("executeSleep", "1");
        dataSource.setDriverProperties(connectionProperties);

        for (int i = 0; i < TEST_COUNT; ++i) {
            p0(dataSource, "boneCP", threadCount);
        }
        System.out.println();
View Full Code Here

        }
        System.out.println();
    }

    public void test_bonecp() throws Exception {
        BoneCPDataSource dataSource = new BoneCPDataSource();
        // dataSource.(10);
        // dataSource.setMaxActive(50);
        dataSource.setMinConnectionsPerPartition(minPoolSize);
        dataSource.setMaxConnectionsPerPartition(maxPoolSize);

        dataSource.setDriverClass(driverClass);
        dataSource.setJdbcUrl(jdbcUrl);
        dataSource.setStatementsCacheSize(maxOpenPreparedStatements);
        dataSource.setServiceOrder("LIFO");
        // dataSource.setMaxOpenPreparedStatements(100);
        dataSource.setUsername(user);
        dataSource.setPassword(password);
        // dataSource.setConnectionTestStatement("SELECT 1");
        dataSource.setPartitionCount(1);
        dataSource.setAcquireIncrement(5);
        dataSource.setIdleConnectionTestPeriod(0L);
        // dataSource.setDisableConnectionTracking(true);

        for (int i = 0; i < loopCount; ++i) {
            p0(dataSource, "boneCP", threadCount);
        }
View Full Code Here

import com.mchange.v2.c3p0.impl.NewProxyPreparedStatement;

public class TestPSCache extends TestCase {

    public void test_boneCP() throws Exception {
        BoneCPDataSource ds = new BoneCPDataSource();
        ds.setJdbcUrl("jdbc:mock:test");
        ds.setPartitionCount(1);
        ds.setMaxConnectionsPerPartition(10);
        ds.setMinConnectionsPerPartition(0);
        ds.setPreparedStatementsCacheSize(10);

        for (int i = 0; i < 10; ++i) {
            f(ds, 5);
            System.out.println("--------------------------------------------");
        }
View Full Code Here

import com.mchange.v2.c3p0.impl.NewProxyConnection;

public class TestLRU extends TestCase {

    public void f_test_boneCP() throws Exception {
        BoneCPDataSource ds = new BoneCPDataSource();
        ds.setJdbcUrl("jdbc:mock:test");
        ds.setPartitionCount(1);
        ds.setMaxConnectionsPerPartition(10);
        ds.setMinConnectionsPerPartition(0);

        for (int i = 0; i < 10; ++i) {
            f(ds, 5);
            System.out.println("--------------------------------------------");
        }
View Full Code Here

        }
        System.out.println();
    }

    public void test_bonecp() throws Exception {
        BoneCPDataSource dataSource = new BoneCPDataSource();
        // dataSource.(10);
        // dataSource.setMaxActive(50);
        dataSource.setMinConnectionsPerPartition(minPoolSize);
        dataSource.setMaxConnectionsPerPartition(maxPoolSize);

        dataSource.setDriverClass(driverClass);
        dataSource.setJdbcUrl(jdbcUrl);
        dataSource.setStatementsCacheSize(100);
        dataSource.setServiceOrder("LIFO");
        // dataSource.setMaxOpenPreparedStatements(100);
        dataSource.setUsername(user);
        dataSource.setPassword(password);
        // dataSource.setConnectionTestStatement("SELECT 1");
        dataSource.setPartitionCount(1);
        dataSource.setAcquireIncrement(5);
        dataSource.setIdleConnectionTestPeriod(0L);
        // dataSource.setDisableConnectionTracking(true);

        for (int i = 0; i < loopCount; ++i) {
            p0(dataSource, "boneCP", threadCount);
        }
View Full Code Here

TOP

Related Classes of com.jolbox.bonecp.BoneCPDataSource

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.