• 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

Identifying Client/Locking

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Locking is the last thing I have to implement in my project.
Would this be an acceptable approach:
From the server, assign clients an ID, store this ID in something like a TreeSet. When the client goes to make an update to the db (book Seats) store the client id, along with the the record being updated, which will indicate a locked record. Then only that client will be allowed to unlock that record.
Then the issue of what happens if a client dies. During times when the server isn't busy run a lower priority thread to verify the existence of clients, then check the for the existence of any locks by non-existent clients and remove.
Any suggestions/comments welcomed...

Dave
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
My thoughts with this are:
How would you assign a unique value to each client? They all look up the same Remote Object (unless you are using a proxy, recently lots of posts on this technique). If you were to get clients to "register" with the server after creation (assign them the next number in a static sequence) it still begs the question "how without changing the lock() signature will you identify them". The remote object wouldn�t know which client was using it.
PS I stuck on this bit too!
Ian
 
Dave McCarthy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting point.
Are we not allowed to change the signature of the lock()/unlock() methods?

Dave
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From memory the spec asks you to implement three methods, criteraFind() and
public void lock(int record)
public void unlock(int record)
I have heard of people changing this signatures and passing. Also people have not tracked the client's and passed.
Ian
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From memory the spec asks you to implement three methods, criteraFind() and
public void lock(int record)
public void unlock(int record)
I have heard of people changing this signatures and passing. Also people have not tracked the client's and passed.
Ian
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
Yes you can change the signature if you need , but just justify your chooice in the essay exam
Ricardo
 
Dave McCarthy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excellent.
I shall attempt to go about seat booking with a client id.

Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic