From 4995844f04b27316a9b0319ff14cd88d82b47167 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Sat, 21 Oct 2017 17:45:12 -0400 Subject: [PATCH] Upgrade to eureka 1.8.4 fixes gh-2386 --- spring-cloud-netflix-dependencies/pom.xml | 2 +- .../eureka/EurekaClientConfigBean.java | 37 +++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index 323b5f43..11ba39b8 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -15,7 +15,7 @@ Spring Cloud Netflix Dependencies 0.7.5 - 1.8.2 + 1.8.4 9.5.1 1.5.12 2.2.2 diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java index 86d191c0..323b607f 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java @@ -387,7 +387,12 @@ public class EurekaClientConfigBean implements EurekaClientConfig { * Indicates whether the client should explicitly unregister itself from the remote server * on client shutdown. */ - private boolean unregisterOnShutdown = true; + private boolean shouldUnregisterOnShutdown = true; + + /** + * Indicates whether the client should enforce registration during initialization. Defaults to false. + */ + private boolean shouldEnforceRegistrationAtInit = false; @Override public boolean shouldGZipContent() { @@ -421,7 +426,12 @@ public class EurekaClientConfigBean implements EurekaClientConfig { @Override public boolean shouldUnregisterOnShutdown() { - return this.unregisterOnShutdown; + return this.shouldUnregisterOnShutdown; + } + + @Override + public boolean shouldEnforceRegistrationAtInit() { + return this.shouldEnforceRegistrationAtInit; } @Override @@ -887,6 +897,22 @@ public class EurekaClientConfigBean implements EurekaClientConfig { this.clientDataAccept = clientDataAccept; } + public boolean isShouldUnregisterOnShutdown() { + return shouldUnregisterOnShutdown; + } + + public void setShouldUnregisterOnShutdown(boolean shouldUnregisterOnShutdown) { + this.shouldUnregisterOnShutdown = shouldUnregisterOnShutdown; + } + + public boolean isShouldEnforceRegistrationAtInit() { + return shouldEnforceRegistrationAtInit; + } + + public void setShouldEnforceRegistrationAtInit(boolean shouldEnforceRegistrationAtInit) { + this.shouldEnforceRegistrationAtInit = shouldEnforceRegistrationAtInit; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -918,6 +944,8 @@ public class EurekaClientConfigBean implements EurekaClientConfig { fetchRegistry == that.fetchRegistry && allowRedirects == that.allowRedirects && onDemandUpdateStatusChange == that.onDemandUpdateStatusChange && + shouldUnregisterOnShutdown == that.shouldUnregisterOnShutdown && + shouldEnforceRegistrationAtInit == that.shouldEnforceRegistrationAtInit && Objects.equals(proxyPort, that.proxyPort) && Objects.equals(proxyHost, that.proxyHost) && Objects.equals(proxyUserName, that.proxyUserName) && @@ -956,7 +984,8 @@ public class EurekaClientConfigBean implements EurekaClientConfig { logDeltaDiff, disableDelta, fetchRemoteRegionsRegistry, availabilityZones, filterOnlyUpInstances, fetchRegistry, dollarReplacement, escapeCharReplacement, allowRedirects, onDemandUpdateStatusChange, - encoderName, decoderName, clientDataAccept); + encoderName, decoderName, clientDataAccept, shouldUnregisterOnShutdown, + shouldEnforceRegistrationAtInit); } @Override @@ -1006,6 +1035,8 @@ public class EurekaClientConfigBean implements EurekaClientConfig { .append("encoderName='").append(encoderName).append("', ") .append("decoderName='").append(decoderName).append("', ") .append("clientDataAccept='").append(clientDataAccept).append("'").append("}") + .append("=shouldUnregisterOnShutdown'").append(shouldUnregisterOnShutdown).append("'").append("}") + .append("shouldEnforceRegistrationAtInit='").append(shouldEnforceRegistrationAtInit).append("'").append("}") .toString(); }