Please don't
shout out your name - it is quite distracting and makes me want to skip your post.
pramod KARNANI wrote:I have question that when lock method is called on already locked record then it has to wait . then it will block the code in while loop , is it okay to block the code ?
You will only be blocking a single
thread, not blocking any other thread that is attempting to run that same bit of code. Sounds reasonable to me.
pramod KARNANI wrote:
lockedRecords.put(recNo, cookie);
...
I do not have cookie in my lock method .
...
I am using Data class instance which implements the DBMain (Sun interface) to identify the Lock owner in lock /unlock/islock methods , is it okay ?
You have said that you do not have a cookie in your lock method and that you are using the instance of the Data class to identify the lock owner. Cool. But why does your code have a variable named cookie?
How are you ensuring that each connected client gets a unique instance of the Data class and that they continue to use this unique instance throughout their interactions with the server?
Andrew