Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is properties in java synchronized?

 
Thennam Pandian
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic