Class MDCUtil


  • public class MDCUtil
    extends Object
    Helper class for MDC manipulation.
    Since:
    9.0.0
    Version:
    $Revision: 24822 $ $Date: 2022-01-28 15:40:05 -0300 (Fri, 28 Jan 2022) $
    • Constructor Detail

      • MDCUtil

        public MDCUtil()
    • Method Detail

      • execWithValues

        public static void execWithValues​(Map<String,​String> values,
                                          Runnable code)
        Executes the given code with the given values in MDC.
        Parameters:
        values - the values.
        code - the code.
        Since:
        9.0.0
      • execWithValues

        public static <T> T execWithValues​(String key,
                                           String value,
                                           Callable<T> code)
        Executes the given code with the given value in MDC.
        Parameters:
        key - the value key.
        value - the value.
        code - the code.
        Returns:
        the code execution return.
        Since:
        9.0.0
      • execWithValues

        public static <T> T execWithValues​(Map<String,​String> values,
                                           Callable<T> code)
        Executes the given code with the given values in MDC.
        Parameters:
        values - the values.
        code - the code.
        Returns:
        the code execution return.
        Since:
        9.0.0
      • clear

        public static void clear()
        Clears current MDC context.
        Since:
        9.0.0