Class MDCUtil


  • public class MDCUtil
    extends Object
    Helper class for MDC manipulation.
    Since:
    9.0.0
    Version:
    $Revision: 19136 $ $Date: 2016-06-02 18:14:45 -0300 (Thu, 02 Jun 2016) $
    • Constructor Detail

      • MDCUtil

        public MDCUtil()
    • Method Detail

      • execWithValues

        public static void execWithValues​(Map<String,​Object> 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,
                                           Object 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,​Object> 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