Проблема подключения Redis с джедаем - PullRequest
0 голосов
/ 07 апреля 2020

Я использую этот код, но получаю проблему с соединением:

JedisConnectionFactory jedisConnectionFactory() {

    JedisConnectionFactory jedisConnectionFactory = null;
    try {
        RedisStandaloneConfiguration redisStandAloneConfiguration = new RedisStandaloneConfiguration(hostName,
            port);
        // make jedis connection factory thread safe (for multi-threaded
        // environment)
        JedisClientConfiguration jedisClientConfiguration = JedisClientConfiguration.builder().usePooling().build();
        jedisConnectionFactory = new JedisConnectionFactory(redisStandAloneConfiguration, jedisClientConfiguration);
        // jedisConnectionFactory uses connection pool by default but with
        // max total of 8
        jedisConnectionFactory.getPoolConfig().setMaxTotal(50);
        jedisConnectionFactory.getPoolConfig().setMaxIdle(50);
        jedisConnectionFactory.afterPropertiesSet();
    } catch (RedisConnectionFailureException e) {
        LOGGER.error("RedisConnectionFailureException in RedisConnector class, Connection break with JEDIS " +
            e.getMessage());
    }

    return jedisConnectionFactory;
}
...