Examples of MCSConnectionPoolConfiguration


Examples of com.volantis.mcs.repository.jdbc.MCSConnectionPoolConfiguration

        configuration.setDriverClassName(driverClassName);

        final String url = (String) properties.get(DATABASE_URL_PROPERTY);
        configuration.setDriverSpecificDatabaseURL(url);

        MCSConnectionPoolConfiguration connectionPoolConfiguration =
                getConnectionPoolConfiguration(factory, properties);
        configuration.setConnectionPoolConfiguration(
                connectionPoolConfiguration);

        return factory.createJDBCDriverDataSource(configuration);
View Full Code Here

Examples of com.volantis.mcs.repository.jdbc.MCSConnectionPoolConfiguration

            configuration.setHost(getHost(properties));
            configuration.setPort(getPort(properties));
        }
        configuration.setSource(getSource(properties));

        MCSConnectionPoolConfiguration connectionPoolConfiguration =
                getConnectionPoolConfiguration(factory, properties);
        configuration.setConnectionPoolConfiguration(
                connectionPoolConfiguration);

        return factory.createMCSDriverDataSource(configuration);
View Full Code Here

Examples of com.volantis.mcs.repository.jdbc.MCSConnectionPoolConfiguration

    public static DataSource createConnectionPool(
            Map properties,
            DataSource dataSource)
            throws RepositoryException {

        MCSConnectionPoolConfiguration configuration =
                getConnectionPoolConfiguration(factory, properties);

        return factory.createMCSConnectionPool(configuration, dataSource);
    }
View Full Code Here

Examples of com.volantis.mcs.repository.jdbc.MCSConnectionPoolConfiguration

    }

    private static MCSConnectionPoolConfiguration getConnectionPoolConfiguration(
            JDBCRepositoryFactory factory, Map properties)
            throws RepositoryException {
        MCSConnectionPoolConfiguration configuration =
                factory.createMCSConnectionPoolConfiguration();

        // Create and configure a Connection pool if there is one.
        String value = (String) properties.get(POOL_ENABLED_PROPERTY);
        configuration.setEnabled("true".equalsIgnoreCase(value));

        int maxConnections;
        int maxFreeConnections;
        //int optimalFreeConnections;
        int minFreeConnections;
        int initialConnections;

        // Get the maximum number of connections allowed.
        try {
            maxConnections =
                    getInt(properties, POOL_MAX_CONNECTIONS_PROPERTY, 10);
        } catch (NumberFormatException nfe) {
            throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format(
                    "jdbc-pool-invalid-max-connections"));
        }

        // Get the maximum number of free connections allowed.
        try {
            maxFreeConnections = getInt(properties,
                    POOL_MAX_FREE_CONNECTIONS_PROPERTY,
                    8);
        } catch (NumberFormatException nfe) {
            throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format(
                    "jdbc-pool-invalid-maxFree-connections"));
        }

        // Get the minimum number of free connections allowed.
        try {
            minFreeConnections = getInt(properties,
                    POOL_MIN_FREE_CONNECTIONS_PROPERTY,
                    2);
        } catch (NumberFormatException nfe) {
            throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format(
                    "jdbc-pool-invalid-minFree-connections"));
        }

        // Get the initial number of free connections created.
        try {
            initialConnections = getInt(properties,
                    POOL_INITIAL_CONNECTIONS_PROPERTY,
                    minFreeConnections);
        } catch (NumberFormatException nfe) {
            throw new JDBCRepositoryException(EXCEPTION_LOCALIZER.format(
                    "jdbc-pool-invalid-initial-connections"));
        }

        boolean keepConnectionsAlive = getKeepConnectionsAlive(properties);
        int connectionPollInterval = getConnectionPollInterval(properties);

        configuration.setInitialConnections(initialConnections);
        configuration.setKeepAliveActive(keepConnectionsAlive);
        configuration.setKeepAlivePollInterval(connectionPollInterval);
        configuration.setMaxConnections(maxConnections);
        configuration.setMaxFreeConnections(maxFreeConnections);
        configuration.setMinFreeConnections(minFreeConnections);
        return configuration;
    }
View Full Code Here

Examples of com.volantis.mcs.repository.jdbc.MCSConnectionPoolConfiguration

    /**
     * Test that createConnectionPool() no longer
     * throws an exception if it is called with an anonymous login.
     */
    public void testCreateConnectionPool() throws RepositoryException {
        MCSConnectionPoolConfiguration configuration =
                new MCSConnectionPoolConfigurationImpl();
        configuration.setEnabled(true);

        dataSourceMock.expects.getConnection()
                .returns(connectionMock).fixed(2);
        connectionMock.expects.getAutoCommit().returns(false).fixed(2);
        connectionMock.expects.getCatalog().returns("catalog").fixed(2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.