Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lock all records before add?

 
Xihang Liu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When is lock-all-record used? Do you need to lock all-record before adding a record?
 
Ricardo Polero
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I don't believe is required to deliver the add and delete operation. Take a better look in your assignment and let me know.
Ricardo
 
Andras Nemeth
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My assignment says that I have to provide all the public methods of the Data class at client side. And somewhere else, that I have to implement network version of Data class functions. So, it means for me that you have to implement add() method.
Add means db lock for me, but I am interested in others opinion about this, also. Because this is a self describer db, record count (the third int in the db) can be spoiled without db lock at add method).
Br,
Ban
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is for some kind of emergency situation on the server side.
For a system like FBN, user will probablly only be allowed to book and search.
Originally posted by Xihang Liu:
When is lock-all-record used? Do you need to lock all-record before adding a record?

 
R Bischof
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for adding / deleting records you don't need a db lock. it is enough if you assure that only only client is adding / deleting records at any given time since you have to check for exsting of the primary key.
Should be enough to make add / delete synchronized
Rainer
 
mitchner green
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To address the original question "When is lock all records used"? I used it when shutting down my server.
If you do a ctrl-c shutdown, clients could have outstanding locks while the server shuts down.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic