Skip to content

Can DefaultThreadContextMap be modified to avoid creating a new instance with each update? #3031

@wang-qijia

Description

@wang-qijia

If the client calls MDC.put() 10 times, the current implementation creates 10 maps, resulting in frequent memory allocations. Is it possible to modify this so that put does not create a new map, and enhance getImmutableMapOrNull to return a decorated immutable version of the original map?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions