List of usage examples for org.springframework.data.redis.connection.lettuce DefaultLettucePool afterPropertiesSet
@SuppressWarnings({ "rawtypes" }) public void afterPropertiesSet()
From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java
@Test public void testCreateFactoryWithPool() { DefaultLettucePool pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort()); pool.setClientResources(LettuceTestClientResources.getSharedClientResources()); pool.afterPropertiesSet(); LettuceConnectionFactory factory2 = new LettuceConnectionFactory(pool); factory2.setShutdownTimeout(0);//from w w w . j a v a2 s . c om factory2.afterPropertiesSet(); ConnectionFactoryTracker.add(factory2); RedisConnection conn2 = factory2.getConnection(); conn2.close(); factory2.destroy(); pool.destroy(); }
From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java
@Ignore("Uncomment this test to manually check connection reuse in a pool scenario") @Test/* w ww. j a va 2 s .co m*/ public void testLotsOfConnections() throws InterruptedException { // Running a netstat here should show only the 8 conns from the pool (plus 2 from setUp and 1 from factory2 // afterPropertiesSet for shared conn) DefaultLettucePool pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort()); pool.afterPropertiesSet(); final LettuceConnectionFactory factory2 = new LettuceConnectionFactory(pool); factory2.afterPropertiesSet(); ConnectionFactoryTracker.add(factory2); for (int i = 1; i < 1000; i++) { Thread th = new Thread(() -> factory2.getConnection().bRPop(50000, "foo".getBytes())); th.start(); } Thread.sleep(234234234); }