Commit 32b3ca41 by Dave Syer

Set registration retries to non-zero by default if peered

parent aa2d0eb4
......@@ -21,16 +21,15 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.netflix.eureka.aws.AwsBindingStrategy;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.netflix.eureka.EurekaConstants;
import org.springframework.core.env.PropertyResolver;
import com.netflix.eureka.EurekaServerConfig;
import com.netflix.eureka.aws.AwsBindingStrategy;
import org.springframework.cloud.netflix.eureka.EurekaConstants;
import org.springframework.core.env.PropertyResolver;
import lombok.Data;
/**
* @author Dave Syer
......@@ -90,7 +89,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
private long aSGUpdateIntervalMs = 5 * MINUTES;
private long aSGCacheExpiryTimeoutMs = 10 * MINUTES; // defaults to longer than the asg update interval
private long aSGCacheExpiryTimeoutMs = 10 * MINUTES; // defaults to longer than the
// asg update interval
private long responseCacheAutoExpirationInSeconds = 180;
......@@ -110,7 +110,6 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
private boolean syncWhenTimestampDiffers = true;
//TODO: what should these defaults be? for single first?
private int registrySyncRetries = 0;
private long registrySyncRetryWaitMs = 30 * 1000;
......@@ -221,8 +220,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
@Override
public Set<String> getRemoteRegionAppWhitelist(String regionName) {
return this.remoteRegionAppWhitelist.get(regionName == null ? "global"
: regionName.trim().toLowerCase());
return this.remoteRegionAppWhitelist
.get(regionName == null ? "global" : regionName.trim().toLowerCase());
}
@Override
......@@ -242,12 +241,12 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
@Override
public String getJsonCodecName() {
return jsonCodecName;
return this.jsonCodecName;
}
@Override
public String getXmlCodecName() {
return xmlCodecName;
return this.xmlCodecName;
}
@Override
......@@ -262,8 +261,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig, EurekaConstan
@Override
public String getExperimental(String name) {
if (propertyResolver != null) {
return propertyResolver.getProperty(PREFIX + ".experimental." + name,
if (this.propertyResolver != null) {
return this.propertyResolver.getProperty(PREFIX + ".experimental." + name,
String.class, null);
}
return null;
......
......@@ -109,8 +109,13 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
protected static class EurekaServerConfigBeanConfiguration {
@Bean
@ConditionalOnMissingBean
public EurekaServerConfig eurekaServerConfig() {
return new EurekaServerConfigBean();
public EurekaServerConfig eurekaServerConfig(EurekaClientConfig clientConfig) {
EurekaServerConfigBean server = new EurekaServerConfigBean();
if (clientConfig.shouldRegisterWithEureka()) {
// Set a sensible default if we are supposed to replicate
server.setRegistrySyncRetries(5);
}
return server;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment