Pervez Ahmed
I'm just now starting and i'm not sure how to go about designing my lock/unlock strategy. Can you or anybody else reading this please give me some tips to get started.
>>> The strategy I used is to hold the locks in a container. whenever you try to lock a particular record number, check whether it is already in the container, if so, wait until it is not there and then lock it. Same way, when you try to unlock a particular record, check whether that record number is in the container if so, unlock it and if not, don't do anything.
If the case is to lock the whole database, put some -1 in the container and check for that. Before locking just make sure that there is no element in the container.
GOOD LUCK then...
Luna Bora
CONGRATULATIONS!! Did you define any timeout for the record lock? If so,what is the value of timeout? How did you shutdown your server? Can I use Ctrl+c to shutdown the server? Thanks for your time.
>>> No, I did'nt use any timeouts for the record locking. Make sure that you call your unlock (from client side) in the finally block so that even if your method fails due to any exception, you make sure that you unlock the record.
>>> Since I'm starting my server from a command line, I guess the only option to shutdown is using ctrl+c. This is how I used and I passed ;-) But if you are running on Unix, since it runs as a process, maybe you can write a shutdown script which checks for the process with particular name and kills it.
Thanks,
- Ravi.