List of usage examples for org.springframework.data.redis.connection RedisConnection isClosed
boolean isClosed();
From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java
@SuppressWarnings("unchecked") @Test/*from w w w. j av a 2 s .c om*/ public void testDisableSharedConnection() throws Exception { factory.setShareNativeConnection(false); RedisConnection conn2 = factory.getConnection(); assertNotSame(connection.getNativeConnection(), conn2.getNativeConnection()); // Give some time for native connection to asynchronously initialize, else close doesn't work Thread.sleep(100); conn2.close(); assertTrue(conn2.isClosed()); // Give some time for native connection to asynchronously close Thread.sleep(100); try { ((RedisAsyncCommands<byte[], byte[]>) conn2.getNativeConnection()).ping(); fail("The native connection should be closed"); } catch (RedisException e) { // expected } }