• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

client tracking.... record number

 
Manish Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What does the record number indicates in the lock method?
Is it the sequence number of a record in the database or it is same as the member variable "recordNumber" of DataInfo?
After examaning the delete()->seek() method of Data class I feel that recordNumber is nothing but the sequence number.
Also the Documentation of the unlock method ("Ignored if the caller does not have a current lock on the requested record.") indicates that there should be something to track the client.
But there are many who have not done anything to track the caller/client.
and I feel that it is not possible for any client to unlock a record without holding that unless there is some bug on the client. Is it necessary to do a client tracking?
Please help me
regards,
Manish
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that in order to fully satisfy the requirements, it is necessary to identify the client somehow.
In my locking mechanism, I use a HashMap to track losked records, where the recordNumber is the key, and the value is a unique object that the client has a reference to.
Then whenever a client attempts to unlock, I do a comparison between the value in the hash map, and the unique object the client is holding. If the comparison passes, they are allowed to unlock.
 
Robin Underwood
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it the sequence number of a record in the database or it is same as the member variable "recordNumber" of DataInfo?

It is both. The record number is the key of the database and provides a unique value to indicate which record should be locked.
As far as identifying the client, I generated a unique sequence number on the server to identify the client, but I think most people have just used the remote connection object itself to identify the client. I think I remember some posts where other people have come up with creative strategies to avoid identifying the client at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic