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

Report a misuse of ConcurrentHashMap #87

@baigd

Description

@baigd

Hi, Developers of alibaba/mdrill,

I am writing to report a misuse of ConcurrentHashMap, which may lead to efficiency problem. I would very appreciate if you could check below for details and confirm with us whether it is a real problem.

File: "alibaba/mdrill/trunk/adhoc-solr/src/main/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java"
Location: Line 100
Description:
The synchronized block form line 100 to line 102 only contains one update operation to the ConcurrentHashMap object. According to the Java API specifications, ConcurrentHashMap can guarantee "high expected concurrency for updates". In this case, there is no multiple operations (such as check-then-act operation) which need atomicity guarantees. Therefore the concurrency can be guaranteed by ConcurrentHaspMap. The locking in line 100 may not be necessary since it causes efficiency problems, which is against the motivation to use the Concurrent Collections. Relying on the ConcurrentHashMap to ensure exclusive access is dangerous since ConcurrentHashMap has no guarantee of exclusive access.

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