Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Concurrency with ConcurrentHashMap and synchronized methods

800306Oct 22 2007 — edited Oct 22 2007
Hi,

I have a class with a private constructor that provides static methods, which add things to or remove things from a Map, which I implement as a ConcurrentHashMap. I want this class to be completely thread-safe.

Is it satisfactory to use a static ConcurrentHashMap with static methods in the class, or do I also need to declare the methods to be synchronized? If so, why?

Thanks,
Dan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2007
Added on Oct 22 2007
7 comments
133 views