use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project spring-data-redis by spring-projects.
the class DefaultLettucePoolTests method testGetResourcePoolExhausted.
@Test
void testGetResourcePoolExhausted() {
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
poolConfig.setMaxTotal(1);
poolConfig.setMaxWaitMillis(1);
pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort(), poolConfig);
pool.setClientResources(LettuceTestClientResources.getSharedClientResources());
pool.afterPropertiesSet();
StatefulRedisConnection<byte[], byte[]> client = (StatefulRedisConnection<byte[], byte[]>) pool.getResource();
assertThat(client).isNotNull();
try {
pool.getResource();
fail("PoolException should be thrown when pool exhausted");
} catch (PoolException e) {
} finally {
client.close();
}
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project spring-data-redis by spring-projects.
the class LettucePoolingClientConfigurationUnitTests method shouldConfigureReadFrom.
// DATAREDIS-956
@Test
void shouldConfigureReadFrom() {
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
LettucePoolingClientConfiguration configuration = //
LettucePoolingClientConfiguration.builder().poolConfig(//
poolConfig).readFrom(//
ReadFrom.MASTER_PREFERRED).build();
assertThat(configuration.getPoolConfig()).isEqualTo(poolConfig);
assertThat(configuration.getReadFrom().orElse(ReadFrom.MASTER)).isEqualTo(ReadFrom.MASTER_PREFERRED);
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project spring-data-redis by spring-projects.
the class LettucePoolingClientConfigurationUnitTests method shouldConfigureClientName.
// DATAREDIS-956
@Test
void shouldConfigureClientName() {
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
LettucePoolingClientConfiguration configuration = //
LettucePoolingClientConfiguration.builder().poolConfig(//
poolConfig).clientName(//
"clientName").build();
assertThat(configuration.getPoolConfig()).isEqualTo(poolConfig);
assertThat(configuration.getClientName()).contains("clientName");
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project atmosphere by Atmosphere.
the class PoolableBroadcasterFactoryTest method testImplementation.
@Test
public void testImplementation() {
assertNotNull(factory.poolableProvider());
assertNotNull(factory.poolableProvider().implementation());
assertEquals(factory.poolableProvider().implementation().getClass(), GenericObjectPool.class);
GenericObjectPool nativePool = (GenericObjectPool) factory.poolableProvider().implementation();
assertTrue(nativePool.getLifo());
GenericObjectPoolConfig c = new GenericObjectPoolConfig();
c.setMaxTotal(1);
nativePool.setConfig(c);
assertEquals(1, nativePool.getMaxTotal());
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project jetcache by alibaba.
the class JetCacheConfig method pool.
@Bean
public Pool<Jedis> pool() {
GenericObjectPoolConfig pc = new GenericObjectPoolConfig();
pc.setMinIdle(2);
pc.setMaxIdle(10);
pc.setMaxTotal(10);
return new JedisPool(pc, "127.0.0.1", 6379);
}
Aggregations