List of usage examples for org.springframework.data.redis.connection RedisClusterConfiguration getMaxRedirects
@Override
public Integer getMaxRedirects()
From source file:org.springframework.data.redis.connection.jedis.JedisConnectionFactory.java
/** * Creates {@link JedisCluster} for given {@link RedisClusterConfiguration} and {@link GenericObjectPoolConfig}. * //from www. j av a 2 s . co m * @param clusterConfig must not be {@literal null}. * @param poolConfig can be {@literal null}. * @return * @since 1.7 */ protected JedisCluster createCluster(RedisClusterConfiguration clusterConfig, GenericObjectPoolConfig poolConfig) { Assert.notNull("Cluster configuration must not be null!"); Set<HostAndPort> hostAndPort = new HashSet<HostAndPort>(); for (RedisNode node : clusterConfig.getClusterNodes()) { hostAndPort.add(new HostAndPort(node.getHost(), node.getPort())); } int redirects = clusterConfig.getMaxRedirects() != null ? clusterConfig.getMaxRedirects().intValue() : 5; if (StringUtils.hasText(getPassword())) { throw new IllegalArgumentException( "Jedis does not support password protected Redis Cluster configurations!"); } if (poolConfig != null) { return new JedisCluster(hostAndPort, timeout, redirects, poolConfig); } return new JedisCluster(hostAndPort, timeout, redirects, poolConfig); }