• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronized methods in the Data class

 
Lokesh katta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
I have gone through the Data class.
Here all the public methods which access data and do data manipulation are synchronized
Along with this there are two private methods which are actually used by the public data methods.In these two the read method is synhronized but the write method is not synchronized
Can anyone explain the reason for me???
And why the readrecord method is synchronised???
Thanks in advance for the replies
WIshing you all
A Happy and prosperous new year
Lokesh
 
Lokesh katta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,
I am waiting for answer for this post and no one yet replied
Jerry atleast you can throw some light on my doubt.
The main doubt eating my head is when readrecord() method is called fron a synchronized method what is the necesity of making the readRecord method also synhronized???
Hoping anyone will answer for this.
Thanx in advance
Lokesh
 
Paul Smiley
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to throw out a question - is there a case where you would want to both lock a record and synchronize the method that accesses it? I mean while writing, you have a lock on the record anyway so there is no need to synchronize is there? And while reading only, you have to synchronize to avoid the event that someone else deletes the record in the middle of your read.
Just my 2 cents...
 
davidlong
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess in ordre to understanding why the read methord was synchronized, u'd better analyse the reading synchronizing partteners. For example, if the record delete method is synchrorized with reading method, u could say the propose of synchronizing read method was prevevnt to deleting record while reading.
just a thought
David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic