File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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: 20279

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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Is properties in java synchronized?
It's not a secret anymore!