Skip to content

ISSUE #2781 Jedis Port Resolving Support #2780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update DefaultJedisClientConfiguration.java
  • Loading branch information
anish8129 authored Nov 20, 2023
commit 59d1b77e578b831fbd6514a4173f2f6176ca457d
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.lang.Nullable;
import redis.clients.jedis.HostAndPortMapper;

/**
* Default implementation of {@literal JedisClientConfiguration}.
Expand All @@ -38,6 +39,7 @@ class DefaultJedisClientConfiguration implements JedisClientConfiguration {
private final Optional<SSLSocketFactory> sslSocketFactory;
private final Optional<SSLParameters> sslParameters;
private final Optional<HostnameVerifier> hostnameVerifier;
private final Optional<HostAndPortMapper> hostAndPortMapper;
private final boolean usePooling;
private final Optional<GenericObjectPoolConfig> poolConfig;
private final Optional<String> clientName;
Expand All @@ -53,33 +55,74 @@ class DefaultJedisClientConfiguration implements JedisClientConfiguration {
this.sslSocketFactory = Optional.ofNullable(sslSocketFactory);
this.sslParameters = Optional.ofNullable(sslParameters);
this.hostnameVerifier = Optional.ofNullable(hostnameVerifier);
this.hostAndPortMapper = Optional.empty();
this.usePooling = usePooling;
this.poolConfig = Optional.ofNullable(poolConfig);
this.clientName = Optional.ofNullable(clientName);
this.readTimeout = readTimeout;
this.connectTimeout = connectTimeout;
}

DefaultJedisClientConfiguration(boolean useSsl, @Nullable SSLSocketFactory sslSocketFactory,
@Nullable SSLParameters sslParameters, @Nullable HostnameVerifier hostnameVerifier,
@Nullable HostAndPortMapper hostAndPortMapper, boolean usePooling,
@Nullable GenericObjectPoolConfig poolConfig, @Nullable String clientName, Duration readTimeout,
Duration connectTimeout) {

this.useSsl = useSsl;
this.sslSocketFactory = Optional.ofNullable(sslSocketFactory);
this.sslParameters = Optional.ofNullable(sslParameters);
this.hostnameVerifier = Optional.ofNullable(hostnameVerifier);
this.hostAndPortMapper = Optional.ofNullable(hostAndPortMapper);
this.usePooling = usePooling;
this.poolConfig = Optional.ofNullable(poolConfig);
this.clientName = Optional.ofNullable(clientName);
this.readTimeout = readTimeout;
this.connectTimeout = connectTimeout;
}

/*
* (non-Javadoc)
* @see org.springframework.data.redis.connection.jedis.JedisClientConfiguration#useSsl()
*/
@Override
public boolean isUseSsl() {
return useSsl;
}

/*
* (non-Javadoc)
* @see org.springframework.data.redis.connection.jedis.JedisClientConfiguration#getSslSocketFactory()
*/
@Override
public Optional<SSLSocketFactory> getSslSocketFactory() {
return sslSocketFactory;
}

/*
* (non-Javadoc)
* @see org.springframework.data.redis.connection.jedis.JedisClientConfiguration#getSslParameters()
*/
@Override
public Optional<SSLParameters> getSslParameters() {
return sslParameters;
}

/*
* (non-Javadoc)
* @see org.springframework.data.redis.connection.jedis.JedisClientConfiguration#getHostnameVerifier()
*/
@Override
public Optional<HostnameVerifier> getHostnameVerifier() {
return hostnameVerifier;
}

@Override
public Optional<HostAndPortMapper> getHostAndPortMapper() {
return hostAndPortMapper;
}


@Override
public boolean isUsePooling() {
return usePooling;
Expand Down