Example usage for org.springframework.data.redis.core RedisConnectionUtils releaseConnection

List of usage examples for org.springframework.data.redis.core RedisConnectionUtils releaseConnection

Introduction

In this page you can find the example usage for org.springframework.data.redis.core RedisConnectionUtils releaseConnection.

Prototype

@Deprecated
public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory) 

Source Link

Document

Closes the given connection, created via the given factory if not managed externally (i.e.

Usage

From source file:com.snowstore.mercury.indicator.RedisHealthIndicator.java

@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
    if (valid) {/* w  w w .  jav  a  2  s. c o m*/
        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();
    }
}