Class MdcContext
- java.lang.Object
-
- org.hawaiiframework.logging.model.MdcContext
-
public final class MdcContext extends Object
Utility to copy the MDC from one thread to another thread.An example of the usage of this class, for a parallel stream:
MdcContext context = MdcContext.getCurrentMdc(); // stream and set context: list.parallelStream().forEach(entry -> { mdcContext.populateMdc(); ... })
- Since:
- 2.0.0
- Author:
- Rutger Lubbers
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MdcContext
getCurrentMdc()
Create a new instance.void
populateMdc()
Set the copied MDC context map into the current thread's MDC.
-
-
-
Method Detail
-
getCurrentMdc
public static MdcContext getCurrentMdc()
Create a new instance.
-
populateMdc
public void populateMdc()
Set the copied MDC context map into the current thread's MDC.
-
-