use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.GenericObjectPool in project cas by apereo.
the class MemcachedMonitorConfiguration method memcachedHealthClientPool.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "memcachedHealthClientPool")
public ObjectPool<MemcachedClientIF> memcachedHealthClientPool(@Qualifier("memcachedMonitorTranscoder") final Transcoder memcachedMonitorTranscoder, final CasConfigurationProperties casProperties) {
val memcached = casProperties.getMonitor().getMemcached();
val factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedMonitorTranscoder);
return new GenericObjectPool<>(factory);
}
use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.GenericObjectPool in project cas by apereo.
the class MemcachedPooledClientConnectionFactory method getObjectPool.
/**
* Gets object pool.
*
* @return the object pool
*/
public ObjectPool<MemcachedClientIF> getObjectPool() {
val pool = new GenericObjectPool<>(this);
pool.setMaxIdle(memcachedProperties.getMaxIdle());
pool.setMinIdle(memcachedProperties.getMinIdle());
pool.setMaxTotal(memcachedProperties.getMaxTotal());
return pool;
}
use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.GenericObjectPool in project spring-framework by spring-projects.
the class CommonsPool2TargetSource method createObjectPool.
/**
* Subclasses can override this if they want to return a specific Commons pool.
* They should apply any configuration properties to the pool here.
* <p>Default is a GenericObjectPool instance with the given pool size.
* @return an empty Commons {@code ObjectPool}.
* @see GenericObjectPool
* @see #setMaxSize
*/
protected ObjectPool createObjectPool() {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMaxTotal(getMaxSize());
config.setMaxIdle(getMaxIdle());
config.setMinIdle(getMinIdle());
config.setMaxWaitMillis(getMaxWait());
config.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis());
config.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
config.setBlockWhenExhausted(isBlockWhenExhausted());
return new GenericObjectPool(this, config);
}
use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.GenericObjectPool in project ddf by codice.
the class SslLdapLoginModule method installLdapConnectionPool.
private void installLdapConnectionPool(String connectionPoolId) {
BundleContext bundleContext = getContext();
if (bundleContext != null) {
try {
Collection<ServiceReference<GenericObjectPool>> serviceReferences = bundleContext.getServiceReferences(GenericObjectPool.class, String.format("(id=%s)", connectionPoolId));
ServiceReference<GenericObjectPool> serviceReference = serviceReferences.stream().findFirst().orElseThrow(() -> new IllegalStateException("No LDAPConnectionPool service found with id:" + connectionPoolId));
ldapConnectionPool = bundleContext.getService(serviceReference);
} catch (InvalidSyntaxException | IllegalStateException e) {
LOGGER.error("Unable to get LDAP Connection pool. LDAP log in will not be possible.", e);
}
}
}
use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.GenericObjectPool in project athenz by yahoo.
the class DataSourceFactory method create.
static PoolableDataSource create(ConnectionFactory connectionFactory) {
// setup our pool config object
GenericObjectPoolConfig config = setupPoolConfig();
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null);
// Set max lifetime of a connection in milli-secs, after which it will
// always fail activation, passivation, and validation.
// Value of -1 means infinite life time. The default value
// defined in this class is 10 minutes.
long connTtlMillis = retrieveConfigSetting(ATHENZ_PROP_DBPOOL_MAX_TTL, MAX_TTL_CONN_MS);
poolableConnectionFactory.setMaxConnLifetimeMillis(connTtlMillis);
if (LOG.isInfoEnabled()) {
LOG.info("Setting Time-To-Live interval for live connections ({}) msecs", connTtlMillis);
}
// set the validation query for our jdbc connector
final String validationQuery = System.getProperty(ATHENZ_PROP_DBPOOL_VALIDATION_QUERY, MYSQL_VALIDATION_QUERY);
poolableConnectionFactory.setValidationQuery(validationQuery);
ObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(poolableConnectionFactory, config);
poolableConnectionFactory.setPool(connectionPool);
return new AthenzDataSource(connectionPool);
}
Aggregations