Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

NonBlockingStatsDClient is not thread-safe #4

@ghost

Description

The class NonBlockingStatsDClient is not thread-safe (and presumably it should be). The reason for this is that a static NumberFormat instance is shared among all threads, but this class itself is not thread-safe. See the "synchronization" section of the NumberFormat docs:

http://docs.oracle.com/javase/6/docs/api/java/text/NumberFormat.html

To fix this problem, either create a new NumberFormat for each call, or create one per thread, using a ThreadLocal<NumberFormat>

http://stackoverflow.com/questions/1285279/java-synchronization-issue-with-numberformat

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