Meaningless Drivel is fun!*
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
Author

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
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

Inside the JDK folder there is a file called src.zip. 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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is properties in java synchronized?