Search in sources :

Example 1 with Config

use of org.apache.commons.pool.impl.GenericObjectPool.Config in project nutzboot by nutzam.

the class SsdbStarter method makeSSDB.

@IocBean(name = "ssdb")
public SSDB makeSSDB() {
    String host = SSDBs.DEFAULT_HOST;
    int port = SSDBs.DEFAULT_PORT;
    int timeout = SSDBs.DEFAULT_TIMEOUT;
    if (conf.has(PROP_HOST)) {
        host = conf.get(PROP_HOST);
    }
    if (conf.has(PROP_PORT)) {
        port = conf.getInt(PROP_PORT);
    }
    if (conf.has(PROP_TIMEOUT)) {
        timeout = conf.getInt(PROP_TIMEOUT);
    }
    Config config = new Config();
    if (conf.has(PROP_MAXACTIVE)) {
        config.maxActive = conf.getInt(PROP_MAXACTIVE);
    } else {
        config.maxActive = 10;
    }
    if (conf.has(PROP_TESTWHILEIDLE)) {
        config.testWhileIdle = conf.getBoolean(PROP_TESTWHILEIDLE);
    } else {
        config.testWhileIdle = true;
    }
    return SSDBs.pool(host, port, timeout, config);
}
Also used : Config(org.apache.commons.pool.impl.GenericObjectPool.Config) IocBean(org.nutz.ioc.loader.annotation.IocBean)

Example 2 with Config

use of org.apache.commons.pool.impl.GenericObjectPool.Config in project directory-ldap-api by apache.

the class ApiLdapClientApiOsgiTest method useBundleClasses.

@Override
protected void useBundleClasses() throws Exception {
    new LdapNetworkConnection().close();
    new SaslGssApiRequest();
    new Krb5LoginConfiguration();
    new AddFuture(new LdapNetworkConnection(), 2);
    new LdapConnectionTemplate(new LdapConnectionPool(new DefaultPoolableLdapConnectionFactory(new LdapConnectionConfig())));
    FilterBuilder.and(FilterBuilder.not(FilterBuilder.contains("cn", "a", "b"))).toString();
    // Test for DIRAPI-239
    PoolableObjectFactory<LdapConnection> factory = new DefaultPoolableLdapConnectionFactory(new LdapConnectionConfig());
    Config config = new Config();
    LdapConnectionPool ldapConnectionPool = new LdapConnectionPool(factory, config);
    ldapConnectionPool.getLdapApiService();
    ldapConnectionPool.getTestOnBorrow();
}
Also used : SaslGssApiRequest(org.apache.directory.ldap.client.api.SaslGssApiRequest) Config(org.apache.commons.pool.impl.GenericObjectPool.Config) LdapConnectionConfig(org.apache.directory.ldap.client.api.LdapConnectionConfig) DefaultPoolableLdapConnectionFactory(org.apache.directory.ldap.client.api.DefaultPoolableLdapConnectionFactory) LdapConnectionTemplate(org.apache.directory.ldap.client.template.LdapConnectionTemplate) LdapConnectionConfig(org.apache.directory.ldap.client.api.LdapConnectionConfig) LdapConnectionPool(org.apache.directory.ldap.client.api.LdapConnectionPool) LdapNetworkConnection(org.apache.directory.ldap.client.api.LdapNetworkConnection) AddFuture(org.apache.directory.ldap.client.api.future.AddFuture) Krb5LoginConfiguration(org.apache.directory.ldap.client.api.Krb5LoginConfiguration) LdapConnection(org.apache.directory.ldap.client.api.LdapConnection)

Aggregations

Config (org.apache.commons.pool.impl.GenericObjectPool.Config)2 DefaultPoolableLdapConnectionFactory (org.apache.directory.ldap.client.api.DefaultPoolableLdapConnectionFactory)1 Krb5LoginConfiguration (org.apache.directory.ldap.client.api.Krb5LoginConfiguration)1 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)1 LdapConnectionConfig (org.apache.directory.ldap.client.api.LdapConnectionConfig)1 LdapConnectionPool (org.apache.directory.ldap.client.api.LdapConnectionPool)1 LdapNetworkConnection (org.apache.directory.ldap.client.api.LdapNetworkConnection)1 SaslGssApiRequest (org.apache.directory.ldap.client.api.SaslGssApiRequest)1 AddFuture (org.apache.directory.ldap.client.api.future.AddFuture)1 LdapConnectionTemplate (org.apache.directory.ldap.client.template.LdapConnectionTemplate)1 IocBean (org.nutz.ioc.loader.annotation.IocBean)1