From b17cb9b92b66c26990300fc0811501cb1fba1054 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 28 Jun 2022 20:13:53 +0900 Subject: [PATCH] Polish gh-31231 See gh-31540 --- .../autoconfigure/health/HealthEndpointProperties.java | 6 +++--- .../springframework/boot/actuate/health/HealthEndpoint.java | 1 + .../boot/actuate/health/HealthEndpointSupport.java | 4 ++-- .../boot/actuate/health/HealthEndpointWebExtension.java | 1 + .../actuate/health/ReactiveHealthEndpointWebExtension.java | 1 + .../src/docs/asciidoc/actuator/endpoints.adoc | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java index 9b5466bfe8..c6c0a53e5f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java @@ -42,9 +42,9 @@ public class HealthEndpointProperties extends HealthProperties { /** * Health endpoint groups. */ - private Map group = new LinkedHashMap<>(); + private final Map group = new LinkedHashMap<>(); - private Logging logging = new Logging(); + private final Logging logging = new Logging(); @Override public Show getShowDetails() { @@ -139,7 +139,7 @@ public class HealthEndpointProperties extends HealthProperties { /** * Threshold after which a warning will be logged for slow health indicators. */ - Duration slowIndicatorThreshold = Duration.ofSeconds(10); + private Duration slowIndicatorThreshold = Duration.ofSeconds(10); public Duration getSlowIndicatorThreshold() { return this.slowIndicatorThreshold; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java index d2f7eae830..5a2aee920c 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpoint.java @@ -66,6 +66,7 @@ public class HealthEndpoint extends HealthEndpointSupport { private final HealthEndpointGroups groups; - private Duration slowIndicatorLoggingThreshold; + private final Duration slowIndicatorLoggingThreshold; /** * Create a new {@link HealthEndpointSupport} instance. @@ -177,7 +177,7 @@ abstract class HealthEndpointSupport { if (duration.compareTo(this.slowIndicatorLoggingThreshold) > 0) { String contributorClassName = contributor.getClass().getName(); Object contributorIdentifier = (!StringUtils.hasLength(name)) ? contributorClassName - : contributor.getClass().getName() + " (" + name + ")"; + : contributorClassName + " (" + name + ")"; logger.warn(LogMessage.format("Health contributor %s took %s to respond", contributorIdentifier, DurationStyle.SIMPLE.print(duration))); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java index b96f3c07ac..e019e3e9bf 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java @@ -66,6 +66,7 @@ public class HealthEndpointWebExtension extends HealthEndpointSupport