Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Identifying Client/Locking

 
Dave McCarthy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
Ricardo Polero
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Excellent.
I shall attempt to go about seat booking with a client id.

Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic