Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: synchronized Db-Interface

 
Rudolph Jen
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am confused. :roll:
At the moment I am working on my implementation of the provided Db-Interface and I would like to synchronize each method except 'lock' and 'unlock'.

I understand 'lock' in that way, that it should guarantie that only one client is able to delete or update a record. It does not mean, that Threads can accessing the db at the same time.

Problem: I would like to allow multiple access, but what is for example:
- Thread 1 is searching db
- Thread 2 is creating/deleting/updating at the same time??

Of course:
- Thread 1 could update recNo 10
- Thread 2 could delete recNo 12
BUT: - Thread 3 could not run find-method clearly

Either I am totally blind oder I don't get the point. I am only confused, because I could here only find very old Topic regarding this.

Any thoughts??
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rudolph Jen:
Hi Guys,

I am confused. :roll:
At the moment I am working on my implementation of the provided Db-Interface and I would like to synchronize each method except 'lock' and 'unlock'.

I understand 'lock' in that way, that it should guarantie that only one client is able to delete or update a record. It does not mean, that Threads can accessing the db at the same time.

Problem: I would like to allow multiple access, but what is for example:
- Thread 1 is searching db
- Thread 2 is creating/deleting/updating at the same time??

Of course:
- Thread 1 could update recNo 10
- Thread 2 could delete recNo 12
BUT: - Thread 3 could not run find-method clearly

Either I am totally blind oder I don't get the point. I am only confused, because I could here only find very old Topic regarding this.

Any thoughts??


Hi,
Have a look at this thread.

http://www.coderanch.com/t/183558/java-developer-SCJD/certification/NX-URLyBird-locking-dirty-reads

Also a recomend doing a search on the term "dirty read".

regards,
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic