Originally posted by Nicky Bodentien:
I think the 25 lines do the minimum required. Any idea if it would affect scoring to do sanity checks (such as whether the client who unlocks a record is the same client that locked the record)?
Regards, George
SCJP, SCJD, SCWCD, SCBCD
I think the 25 lines do the minimum required. Any idea if it would affect scoring to do sanity checks (such as whether the client who unlocks a record is the same client that locked the record)?
George:
If you're only providing business methods that hide the locking from the client then you're definitely OK, since the client can't help but follow your locking protocol.
Javini:
Locks a record so that it can only be updated or deleted by this client.
If you have that line or something like it, and you expose Data to the client,
I suspect that you must not allow another client to unlock a record that
the original client locked.
Originally posted by Philippe Maquet:
Do you really think that an architectural decision of yours (placing your business layer server-side instead of client-side) should allow you to change the contract the data layer must implement?
Do you have one of the cookie-free Sun-supplied interfaces? If so, then you're probably OK if you are making all the database operations available directly to the client and you rely on a comment to say that the protocol of lock, database_operation, unlock, must be called in the same method whenever the client wants exclusive access to a particular record. If you're only providing business methods that hide the locking from the client then you're definitely OK, since the client can't help but follow your locking protocol.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Vish Kumar:
Have you guys heard/known anybody of passing/failing the assignment with such simple locking designs of this size. Just wanted to make sure that myself and Nicky are not the first people to attempt this
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Original Nicky's question:
Any idea if it would affect scoring to do sanity checks (such as whether the client who unlocks a record is the same client that locked the record)?
Your answer:
Do you have one of the cookie-free Sun-supplied interfaces? If so, then you're probably OK if you are making all the database operations available directly to the client and you rely on a comment to say that the protocol of lock, database_operation, unlock, must be called in the same method whenever the client wants exclusive access to a particular record. If you're only providing business methods that hide the locking from the client then you're definitely OK, since the client can't help but follow your locking protocol.
Javini's answer:
Locks a record so that it can only be updated or deleted by this client.
If you have that line or something like it, and you expose Data to the client,
I suspect that you must not allow another client to unlock a record that
the original client locked.
George:
To restate my point in brief: if you adhere to the locking protocol of the Data class on the server-side and if you don't expose the lock and unlock methods to the client-side, but instead provide business methods (which themselves adhere to the locking protocol), then the client-side need not be aware of the locking protocol.
Originally posted by Nicky Bodentien:
George, did you have locking cookies? The presence of locking cookies in the interface would necessitate sanity checks, I figure.
My Sun interface:
So as you can see, I didn't have lock cookie. I don't like the way I implemented the lock and unlock methods anymore since I think I failed to satisfy the "Locks a record so that it can only be updated or deleted by this client" requirement. My locking protocol if followed will guarantee that this requirement will be satisfied, but only if the locking protocol is followed. I now believe the lock method needs to identify the client and store this information along with the record number in the lock variable. Ken Krebs gives a very good description of this in in his design summary. I refer you to the locking section.
George, I agree with you that the GUI needn't worry about the locking protocol if the server does not expose locking. It does in my design, though, so that the GUI can have the server lock a record while the user edits or books it.
My design exposed locking to the client and I did so for the same reason you state. I think the server should be able to lock a record while the user edits or books it, but this is a minority opinion on this forum. From my reading I think most people are using an optomistic booking strategy, that is, when a client books a record the client must type in the customer ID before the lock is acquired. I prefer the pessimistic booking strategy that we are using. In other words, until a lock has been acquired it's not a good idea to make the user type in the customer ID. I think the pessimistic booking strategy also handles the issue of booking an already booked record in an elegant manner.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
I found a beautiful pie. And a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|