From 4ac56faac948e4348d2dac6ffd08c0ad88e67dea Mon Sep 17 00:00:00 2001 From: Olivia Kotsopoulos Date: Thu, 29 Feb 2024 17:53:32 -0500 Subject: [PATCH] MdcHelper, MdcHelperTest needn't be public The MdcHelper methods are only meant to be called within the Stairway implementation package. --- .../bio/terra/stairway/impl/MdcHelper.java | 22 +++++++++---------- .../terra/stairway/impl/MdcHelperTest.java | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/stairway/src/main/java/bio/terra/stairway/impl/MdcHelper.java b/stairway/src/main/java/bio/terra/stairway/impl/MdcHelper.java index f3143a5..00ce6d0 100644 --- a/stairway/src/main/java/bio/terra/stairway/impl/MdcHelper.java +++ b/stairway/src/main/java/bio/terra/stairway/impl/MdcHelper.java @@ -6,31 +6,31 @@ import org.slf4j.MDC; /** - * Utility methods to make Stairway flight runnables context-aware, using mapped diagnostic context (MDC). + * Utility methods to make Stairway flight runnables context-aware, using mapped diagnostic context + * (MDC). */ -public class MdcHelper { +class MdcHelper { /** ID of the flight */ - public static final String FLIGHT_ID_KEY = "flightId"; + static final String FLIGHT_ID_KEY = "flightId"; /** Class of the flight */ - public static final String FLIGHT_CLASS_KEY = "flightClass"; + static final String FLIGHT_CLASS_KEY = "flightClass"; /** Class of the flight step */ - public static final String FLIGHT_STEP_CLASS_KEY = "flightStepClass"; + static final String FLIGHT_STEP_CLASS_KEY = "flightStepClass"; /** Direction of the step (START, DO, SWITCH, or UNDO) */ - public static final String FLIGHT_STEP_DIRECTION_KEY = "flightStepDirection"; + static final String FLIGHT_STEP_DIRECTION_KEY = "flightStepDirection"; /** The step's execution order */ - public static final String FLIGHT_STEP_NUMBER_KEY = "flightStepNumber"; + static final String FLIGHT_STEP_NUMBER_KEY = "flightStepNumber"; /** * @return the flightRunner modified to propagate the MDC from the calling thread and * flight-specific context to the child thread spawned to run the flight. */ - public static Runnable withMdcAndFlightContext( - Runnable flightRunner, FlightContext flightContext) { + static Runnable withMdcAndFlightContext(Runnable flightRunner, FlightContext flightContext) { // Save the calling thread's context Map contextMap = MDC.getCopyOfContextMap(); return () -> { @@ -66,11 +66,11 @@ private static Map stepContextForMdc(FlightContext context) { FLIGHT_STEP_NUMBER_KEY, Integer.toString(context.getStepIndex())); } - public static void addStepContextToMdc(FlightContext context) { + static void addStepContextToMdc(FlightContext context) { stepContextForMdc(context).forEach(MDC::put); } - public static void removeStepContextFromMdc(FlightContext context) { + static void removeStepContextFromMdc(FlightContext context) { stepContextForMdc(context).keySet().forEach(MDC::remove); } } diff --git a/stairway/src/test/java/bio/terra/stairway/impl/MdcHelperTest.java b/stairway/src/test/java/bio/terra/stairway/impl/MdcHelperTest.java index c017513..4ca9640 100644 --- a/stairway/src/test/java/bio/terra/stairway/impl/MdcHelperTest.java +++ b/stairway/src/test/java/bio/terra/stairway/impl/MdcHelperTest.java @@ -16,7 +16,7 @@ import org.slf4j.MDC; @Tag("unit") -public class MdcHelperTest { +class MdcHelperTest { private static final Map FOO_BAR = Map.of("foo", "bar"); private static final String FLIGHT_ID = "flightId" + UUID.randomUUID(); private static final String FLIGHT_CLASS = "flightClass" + UUID.randomUUID();