Record Class MdcPropagationContext
java.lang.Object
java.lang.Record
io.micronaut.context.propagation.slf4j.MdcPropagationContext
- Record Components:
state- The MDC state as map
- All Implemented Interfaces:
PropagatedContextElement,ThreadPropagatedContextElement<Map<String,String>>
public record MdcPropagationContext(Map<String,String> state)
extends Record
implements ThreadPropagatedContextElement<Map<String,String>>
MDC propagation.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Constructor Summary
ConstructorsConstructorDescriptionMdcPropagationContext(Map<String, String> state) Creates an instance of aMdcPropagationContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.voidrestoreThreadContext(Map<String, String> oldState) Restore the state on the propagation exit.state()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.Update the thread context on the propagation entry and return the state that will be used for the restore on the propagation exit.
-
Constructor Details
-
MdcPropagationContext
public MdcPropagationContext() -
MdcPropagationContext
Creates an instance of aMdcPropagationContextrecord class.- Parameters:
state- the value for thestaterecord component
-
-
Method Details
-
updateThreadContext
Description copied from interface:ThreadPropagatedContextElementUpdate the thread context on the propagation entry and return the state that will be used for the restore on the propagation exit.- Specified by:
updateThreadContextin interfaceThreadPropagatedContextElement<Map<String,String>> - Returns:
- The state to be restored
-
restoreThreadContext
Description copied from interface:ThreadPropagatedContextElementRestore the state on the propagation exit.- Specified by:
restoreThreadContextin interfaceThreadPropagatedContextElement<Map<String,String>> - Parameters:
oldState- The state to be restored
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
state
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-