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

Locking question

 
fei lin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on B&S project, I only provide client with 2 methods:
- book(int rec)
- search(string[] criteria)

should I do locking on server or client? is the above method exposed to client enough?

Thanks in advance
 
Chih-Wei Lee
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion, you should do locking on server.
cuz you will need to do locking by implementing lock(int recNo) in Data class and this should be on server side. The client doesn't need to care about the record locking. You just expose the book method to client.Then book method will probably invoke lock()->update()->unlock(). This depends on your design.
 
Zhongbo Li
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Server
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;


book(int rec)


who is the customer booking this recrod , i think you must pass additional
parameter customer number:

book(int rec, String eightDigitCustNumber)

also may be another clients delete this record during client view and another one create another record with different data in the same location
so the record number for new record will be the same and when the viewing
client want to book record he will book the new record that differ

Best regards.
Mohamed Darim.
 
fei lin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mohamed sulibi:
hi;



who is the customer booking this recrod , i think you must pass additional
parameter customer number:

book(int rec, String eightDigitCustNumber)

also may be another clients delete this record during client view and another one create another record with different data in the same location
so the record number for new record will be the same and when the viewing
client want to book record he will book the new record that differ

Best regards.
Mohamed Darim.


Thanks Mohamed, so client book the wrong record, is that acceptable?
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by fei lin:


Thanks Mohamed, so client book the wrong record, is that acceptable?


Hi,

I think what Mohamed meant, is that you should make sure that the client holds the "latest" data of the record he wants to book. For instance, the client could be working on "old" data and I believe you should prevent him from modifying such record.

So, you could consider passing the original record and compare it to the database before allowing its update/booking.

But that's at the "service/Business" level, the Data layer does not care..

bye,
Alex
[ March 24, 2008: Message edited by: Alex Belisle Turcot ]
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;

thank you Alex for your reply i mean exactly what you said.

best regards.
Mohamed Darim.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic