This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes Is properties in java synchronized? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Is properties in java synchronized?" Watch "Is properties in java synchronized?" New topic

Is properties in java synchronized?

Thennam Pandian
Ranch Hand

Joined: Oct 11, 2005
Posts: 163
We know that the Properties class is a sub-class of Hashtable. So all the inherited method are synchronized.
What about the Properties own method like load , store ... etc
Rob Spoor

Joined: Oct 27, 2005
Posts: 20188

Inside the JDK folder there is a file called This contains the source for most of the classes in the API.

But let me save you the trouble of looking it up. Most public methods are synchronized. The store methods aren't, but they use synchronization internally. getProperty also isn't synchronized but it uses super.get which is synchronized. All in all, the API says
This class is thread-safe: multiple threads can share a single Properties object without the need for external synchronization

How To Ask Questions How To Answer Questions
subject: Is properties in java synchronized?
It's not a secret anymore!