Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a simple question of Locking mechanism

 
Gerenne Vives
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

I have a simple question , It is necesary to use the lock class when I search a record in mode networked ?

Thanks
 
dennis du
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No,there is no need to lock for the read operation.
 
dennis du
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a general rule from database field.
 
Gerenne Vives
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok ,thanks for your help.

Irene.
 
Frank Verbruggen
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not needed.

But, I chose to lock the entire database when I do any operation.
This seems like a dumb thing at first, but it saves u a lot of scenario testing for your locking scheme.
Furthermore, good table based locking (not the one we are implementing) is FASTER than record based locking.
This is because of the lack of overhead on row level locks.
So even though it is not needed to lock when reading, I would (and do).
Document your decisions well !
Good luck
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Verbruggen:
It is not needed.

But, I chose to lock the entire database when I do any operation.
This seems like a dumb thing at first, but it saves u a lot of scenario testing for your locking scheme.
Furthermore, good table based locking (not the one we are implementing) is FASTER than record based locking.
This is because of the lack of overhead on row level locks.
So even though it is not needed to lock when reading, I would (and do).
Document your decisions well !
Good luck


Will it not affect the number of concurreny users access? Since the data item granularity is so large like that to the table, I am quite sure that some other users might not be able to access that table during the time someone is accessing it...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic