List of usage examples for org.springframework.data.redis.core RedisConnectionUtils getConnection
public static RedisConnection getConnection(RedisConnectionFactory factory)
From source file:com.snowstore.mercury.indicator.RedisHealthIndicator.java
@Override protected void doHealthCheck(Health.Builder builder) throws Exception { if (valid) {/*from w ww. jav a2 s . com*/ RedisConnection connection = RedisConnectionUtils.getConnection(this.redisConnectionFactory); try { Properties info = connection.info(); builder.up().withDetail("version", info.getProperty("redis_version")); if (redisConnectionFactory instanceof JedisConnectionFactory) { JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisConnectionFactory; builder.withDetail(SERVER, jedisConnectionFactory.getHostName() + ":" + jedisConnectionFactory.getPort() + ":" + jedisConnectionFactory.getDatabase()); } addBuilder(builder); } finally { RedisConnectionUtils.releaseConnection(connection, this.redisConnectionFactory); } } else { builder.none(); } }