• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Locking question

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Server
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi;

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

best regards.
Mohamed Darim.
 
Because those who mind don't matter and those who matter don't mind - Seuss. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic