Hey Ken,
In my case, unlock only looks in the locked map, not the contractors collection, so it only throws RecordNotFoundException if it's not in the locked map.
makes sense and clears things up for me - thanks
In my case, if the lock method looks in the contractor collection and can't find it, the exception will be thrown and update will never be called. Once it finds it during lock, it should not fail during the update invocation because the lock prevents any other thread from deleting it. My book method contains the calls to lock/update/unlock and throws RecordNotFoundEception up to its client if it occurs and the client will report it to the user.
I see, so your contract for update also applys to book - am I correct?
This is a very nice solution. My only minor issue is calliing RecordNotFoundException for two different conditions. Unlock if not in
locked collection, for lock if not in contractor collection. But its the nicest solution I have seen yet.
thanks Ken,
bill