• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writeRecord

 
Thomas Mathai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain why the writeRecord method is NOT synchronized while all the other methods are?
 
vladimir levin
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the writeRecord() method is a private method of the Data clas.
It is only called by the public methods of the Data class, which
are synchronized. Therefore, since it will always be called
from a synchronized code block, there is no need to synchronize
this method.
Vlad
 
Thomas Mathai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vladimir. But so is the readRecord method. It is private too, but it is synchronized. Isn't this inconsistent, if nothing else, from a style viewpoint?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic