Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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
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: 19656

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
I agree. Here's the link:
subject: Is properties in java synchronized?
Similar Threads
Thread-safe Action class ?
Interface with strictfp
Doubt in Interfaces
Can Overloaded method be synchronized
can i define a native method in an interface??