/** * Create a {@link LettuceConnectionProvider} given {@link AbstractRedisClient} and {@link RedisCodec}. Configuration * of this connection factory specifies the type of the created connection provider. This method creates either a * {@link LettuceConnectionProvider} for either {@link RedisClient} or {@link RedisClusterClient}. Subclasses may * override this method to decorate the connection provider. * * @param client either {@link RedisClient} or {@link RedisClusterClient}, must not be {@literal null}. * @param codec used for connection creation, must not be {@literal null}. By default, a {@code byte[]} codec. * Reactive connections require a {@link java.nio.ByteBuffer} codec. * @return the connection provider. * @since 2.1 */ protected LettuceConnectionProvider doCreateConnectionProvider(AbstractRedisClient client, RedisCodec<?, ?> codec) { ReadFrom readFrom = getClientConfiguration().getReadFrom().orElse(null); if (isStaticMasterReplicaAware()) { List<RedisURI> nodes = ((RedisStaticMasterReplicaConfiguration) configuration).getNodes().stream() // .map(it -> createRedisURIAndApplySettings(it.getHostName(), it.getPort())) // .peek(it -> it.setDatabase(getDatabase())) // .collect(Collectors.toList()); return new StaticMasterReplicaConnectionProvider((RedisClient) client, codec, nodes, readFrom); } if (isClusterAware()) { return new ClusterConnectionProvider((RedisClusterClient) client, codec, readFrom); } return new StandaloneConnectionProvider((RedisClient) client, codec, readFrom); }
initialUris.add(createRedisURIAndApplySettings(node.getHost(), node.getPort())); : createRedisURIAndApplySettings(getHostName(), getPort());
/** * Create a {@link LettuceConnectionProvider} given {@link AbstractRedisClient} and {@link RedisCodec}. Configuration * of this connection factory specifies the type of the created connection provider. This method creates either a * {@link LettuceConnectionProvider} for either {@link RedisClient} or {@link RedisClusterClient}. Subclasses may * override this method to decorate the connection provider. * * @param client either {@link RedisClient} or {@link RedisClusterClient}, must not be {@literal null}. * @param codec used for connection creation, must not be {@literal null}. By default, a {@code byte[]} codec. * Reactive connections require a {@link java.nio.ByteBuffer} codec. * @return the connection provider. * @since 2.1 */ protected LettuceConnectionProvider doCreateConnectionProvider(AbstractRedisClient client, RedisCodec<?, ?> codec) { ReadFrom readFrom = getClientConfiguration().getReadFrom().orElse(null); if (isStaticMasterReplicaAware()) { List<RedisURI> nodes = ((RedisStaticMasterReplicaConfiguration) configuration).getNodes().stream() // .map(it -> createRedisURIAndApplySettings(it.getHostName(), it.getPort())) // .peek(it -> it.setDatabase(getDatabase())) // .collect(Collectors.toList()); return new StaticMasterReplicaConnectionProvider((RedisClient) client, codec, nodes, readFrom); } if (isClusterAware()) { return new ClusterConnectionProvider((RedisClusterClient) client, codec, readFrom); } return new StandaloneConnectionProvider((RedisClient) client, codec, readFrom); }
/** * Create a {@link LettuceConnectionProvider} given {@link AbstractRedisClient} and {@link RedisCodec}. Configuration * of this connection factory specifies the type of the created connection provider. This method creates either a * {@link LettuceConnectionProvider} for either {@link RedisClient} or {@link RedisClusterClient}. Subclasses may * override this method to decorate the connection provider. * * @param client either {@link RedisClient} or {@link RedisClusterClient}, must not be {@literal null}. * @param codec used for connection creation, must not be {@literal null}. By default, a {@code byte[]} codec. * Reactive connections require a {@link java.nio.ByteBuffer} codec. * @return the connection provider. * @since 2.1 */ protected LettuceConnectionProvider doCreateConnectionProvider(AbstractRedisClient client, RedisCodec<?, ?> codec) { ReadFrom readFrom = getClientConfiguration().getReadFrom().orElse(null); if (isStaticMasterReplicaAware()) { List<RedisURI> nodes = ((RedisStaticMasterReplicaConfiguration) configuration).getNodes().stream() // .map(it -> createRedisURIAndApplySettings(it.getHostName(), it.getPort())) // .peek(it -> it.setDatabase(getDatabase())) // .collect(Collectors.toList()); return new StaticMasterReplicaConnectionProvider((RedisClient) client, codec, nodes, readFrom); } if (isClusterAware()) { return new ClusterConnectionProvider((RedisClusterClient) client, codec, readFrom); } return new StandaloneConnectionProvider((RedisClient) client, codec, readFrom); }
initialUris.add(createRedisURIAndApplySettings(node.getHost(), node.getPort())); : createRedisURIAndApplySettings(getHostName(), getPort());
initialUris.add(createRedisURIAndApplySettings(node.getHost(), node.getPort())); : createRedisURIAndApplySettings(getHostName(), getPort());