Commit 8147b7de by Spencer Gibb

Merge pull request #575 from alexVengrovsk/master

* pull575: Use "<>" and use isInfoEnabled
parents 810502c1 4510f657
...@@ -110,7 +110,7 @@ public class EurekaClientConfigBean implements EurekaClientConfig { ...@@ -110,7 +110,7 @@ public class EurekaClientConfigBean implements EurekaClientConfig {
private String fetchRemoteRegionsRegistry; private String fetchRemoteRegionsRegistry;
private Map<String, String> availabilityZones = new HashMap<String, String>(); private Map<String, String> availabilityZones = new HashMap<>();
private boolean filterOnlyUpInstances = true; private boolean filterOnlyUpInstances = true;
......
...@@ -95,9 +95,12 @@ public class EurekaDiscoveryClientConfiguration implements SmartLifecycle, Order ...@@ -95,9 +95,12 @@ public class EurekaDiscoveryClientConfiguration implements SmartLifecycle, Order
if (!this.running.get() && this.instanceConfig.getNonSecurePort() > 0) { if (!this.running.get() && this.instanceConfig.getNonSecurePort() > 0) {
this.eurekaClient.getApplications(); // force initialization this.eurekaClient.getApplications(); // force initialization
if (log.isInfoEnabled()) {
log.info("Registering application " + this.instanceConfig.getAppname() log.info("Registering application " + this.instanceConfig.getAppname()
+ " with eureka with status " + " with eureka with status "
+ this.instanceConfig.getInitialStatus()); + this.instanceConfig.getInitialStatus());
}
this.applicationInfoManager this.applicationInfoManager
.setInstanceStatus(this.instanceConfig.getInitialStatus()); .setInstanceStatus(this.instanceConfig.getInitialStatus());
...@@ -114,8 +117,12 @@ public class EurekaDiscoveryClientConfiguration implements SmartLifecycle, Order ...@@ -114,8 +117,12 @@ public class EurekaDiscoveryClientConfiguration implements SmartLifecycle, Order
@Override @Override
public void stop() { public void stop() {
if (this.applicationInfoManager.getInfo() != null) { if (this.applicationInfoManager.getInfo() != null) {
if (log.isInfoEnabled()) {
log.info("Unregistering application " + this.instanceConfig.getAppname() log.info("Unregistering application " + this.instanceConfig.getAppname()
+ " with eureka with status DOWN"); + " with eureka with status DOWN");
}
this.applicationInfoManager.setInstanceStatus(InstanceStatus.DOWN); this.applicationInfoManager.setInstanceStatus(InstanceStatus.DOWN);
} }
this.running.set(false); this.running.set(false);
......
...@@ -64,15 +64,19 @@ public class InstanceInfoFactory { ...@@ -64,15 +64,19 @@ public class InstanceInfoFactory {
// Start off with the STARTING state to avoid traffic // Start off with the STARTING state to avoid traffic
if (!config.isInstanceEnabledOnit()) { if (!config.isInstanceEnabledOnit()) {
InstanceInfo.InstanceStatus initialStatus = InstanceInfo.InstanceStatus.STARTING; InstanceInfo.InstanceStatus initialStatus = InstanceInfo.InstanceStatus.STARTING;
if (log.isInfoEnabled()) {
log.info("Setting initial instance status as: " + initialStatus); log.info("Setting initial instance status as: " + initialStatus);
}
builder.setStatus(initialStatus); builder.setStatus(initialStatus);
} }
else { else {
if (log.isInfoEnabled()) {
log.info("Setting initial instance status as: " log.info("Setting initial instance status as: "
+ InstanceInfo.InstanceStatus.UP + InstanceInfo.InstanceStatus.UP
+ ". This may be too early for the instance to advertise itself as available. " + ". This may be too early for the instance to advertise itself as available. "
+ "You would instead want to control this via a healthcheck handler."); + "You would instead want to control this via a healthcheck handler.");
} }
}
// Add any user-specific metadata information // Add any user-specific metadata information
for (Map.Entry<String, String> mapEntry : config.getMetadataMap().entrySet()) { for (Map.Entry<String, String> mapEntry : config.getMetadataMap().entrySet()) {
......
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