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

Bodgitt & Scarper contractor booking

 
joe jones
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am working on B&S version 2.2.1 and have a few questions about booking of contractors. At the moment, I have a table of contractors from the database, and a client is able to select a particular row and click 'Book', which then generates a random long (representing the CSR number), and updates the table, displaying this long in the 'Owner' column. The book() method uses a lock(), update(), unlock() sequence of operations, synchronized on a hashmap of currently locked records.

My question is this -- are other clients able to book contractors which are already booked? So if Client1 books contractor 5, is Client2 then allowed to overwrite this booking? If not, should a message be shown to the client that the contractor is already booked???

Thanks for any tips...

joe
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

I have assumed that it is not allowed to book an already booked client. What would be the purpose of booking if the booking can be overwritten?

I made the book functionality perform the sequence lock - read - update - unlock, where the read call is to verify that the contractor is not booked yet. If the contractor is already booked, the booking is aborted of course.

IMHO, this sequence is the primary reason why we need to have lock/unlock methods to begin with: only when the record is locked can we be certain that no other client has just booked the contractor.

Frans.
 
Clivant Yeo
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

Just make sure that the first thread to book a record gets to book the record. The rest of the thread which wants to book the record afterwards should be denied.

Regards,
Clivant
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which then generates a random long (representing the CSR number),
I am slightly off topic, but I noticed this and wondered why you decided to generate a random number instead of letting the user enter one in. My instructions state
Note that for this application, you should assume that customers and CSRs know their customer ids.
I would hate to see you lose any unneccessary points.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic