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
log.info("Registering application " + this.instanceConfig.getAppname()
+ " with eureka with status " if (log.isInfoEnabled()) {
+ this.instanceConfig.getInitialStatus()); log.info("Registering application " + this.instanceConfig.getAppname()
+ " with eureka with status "
+ 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) {
log.info("Unregistering application " + this.instanceConfig.getAppname()
+ " with eureka with status DOWN"); if (log.isInfoEnabled()) {
log.info("Unregistering application " + this.instanceConfig.getAppname()
+ " with eureka with status DOWN");
}
this.applicationInfoManager.setInstanceStatus(InstanceStatus.DOWN); this.applicationInfoManager.setInstanceStatus(InstanceStatus.DOWN);
} }
this.running.set(false); this.running.set(false);
......
...@@ -64,14 +64,18 @@ public class InstanceInfoFactory { ...@@ -64,14 +64,18 @@ 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;
log.info("Setting initial instance status as: " + initialStatus); if (log.isInfoEnabled()) {
log.info("Setting initial instance status as: " + initialStatus);
}
builder.setStatus(initialStatus); builder.setStatus(initialStatus);
} }
else { else {
log.info("Setting initial instance status as: " if (log.isInfoEnabled()) {
+ InstanceInfo.InstanceStatus.UP log.info("Setting initial instance status as: "
+ ". This may be too early for the instance to advertise itself as available. " + InstanceInfo.InstanceStatus.UP
+ "You would instead want to control this via a healthcheck handler."); + ". This may be too early for the instance to advertise itself as available. "
+ "You would instead want to control this via a healthcheck handler.");
}
} }
// Add any user-specific metadata information // Add any user-specific metadata information
......
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