Skip to content
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

Redisson DNS Monitoring Interval #372

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public Redisson getRedisson(RedisLockProperties properties) {
.useSingleServer()
.setAddress(redisServerAddress)
.setPassword(redisServerPassword)
.setTimeout(connectionTimeout);
.setTimeout(connectionTimeout)
.setDnsMonitoringInterval(properties.getDnsMonitoringInterval());
break;
case CLUSTER:
LOGGER.info("Setting up Redis Cluster for RedisLockConfiguration");
Expand All @@ -82,7 +83,8 @@ public Redisson getRedisson(RedisLockProperties properties) {
.setMasterConnectionMinimumIdleSize(
properties.getClusterPrimaryConnectionMinIdleSize())
.setMasterConnectionPoolSize(
properties.getClusterPrimaryConnectionPoolSize());
properties.getClusterPrimaryConnectionPoolSize())
.setDnsMonitoringInterval(properties.getDnsMonitoringInterval());
break;
case SENTINEL:
LOGGER.info("Setting up Redis Sentinel Servers for RedisLockConfiguration");
Expand All @@ -92,7 +94,8 @@ public Redisson getRedisson(RedisLockProperties properties) {
.setMasterName(masterName)
.addSentinelAddress(redisServerAddress)
.setPassword(redisServerPassword)
.setTimeout(connectionTimeout);
.setTimeout(connectionTimeout)
.setDnsMonitoringInterval(properties.getDnsMonitoringInterval());
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class RedisLockProperties {
*/
private boolean ignoreLockingExceptions = false;

/** Interval in milliseconds to check the endpoint's DNS (Set -1 to disable). */
private long dnsMonitoringInterval = 5000L;

public REDIS_SERVER_TYPE getServerType() {
return serverType;
}
Expand Down Expand Up @@ -143,6 +146,14 @@ public void setClusterPrimaryConnectionPoolSize(Integer clusterPrimaryConnection
this.clusterPrimaryConnectionPoolSize = clusterPrimaryConnectionPoolSize;
}

public long getDnsMonitoringInterval() {
return dnsMonitoringInterval;
}

public void setDnsMonitoringInterval(long dnsMonitoringInterval) {
this.dnsMonitoringInterval = dnsMonitoringInterval;
}

public enum REDIS_SERVER_TYPE {
SINGLE,
CLUSTER,
Expand Down