I am done with the coding of my project..URLYBird 1.1.2.It took me 120 hrs approx. I have a requirement for my lock method which states that: "If the specified record is already locked by a different client, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked".
I have implemented timeout and reentrant locks in my reservation lock manager class . I think that if a thread conditionally waits for a short timeout or until a lock is released (whichever comes earlier) would not consume CPU cycles,since after the timeout the thread gives up as opposed to blocking continously until the lock is released.
I think you should NOT use timeouts based on my understanding from the Monkhouse's book and posts. Pay attention to the part where it says "by another client" if it is written in the assignment this means that if the client is trying to lock a record that is already locked by itself the client should not wait.