• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic