This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

client tracking.... record number

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic