File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Something wrong with lock() method signature ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Something wrong with lock() method signature ?" Watch "Something wrong with lock() method signature ?" New topic

Something wrong with lock() method signature ?

Kelly Wood
Ranch Hand

Joined: Nov 07, 2004
Posts: 54
The lock() method given on my assignment does not seem right - it does not return a cookie that identifies a client, even though the comment explicitly states that the lock is used to lock a record so that it can only be updated/deleted by this client. I presume 'client' means an actual user. But in this case, is it reasonable to assume 'this client' implies 'this thread'?

Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
That just means you need to be creative.
Your required locking system will force you to do things differently from most people, keeping track of clients and cookies on the server completely (you can get client specific information on the server, see my previous thread on that) rather than passing the cookie to the client and letting him send it back to you.

Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi Kelly,

I have the same lock methodoligy like you.
If you choose to use RMI you can not assume that :

'this client' implies 'this thread'

beacuse you don't know what is hinding behind the RMI.
You must think on a other way to keep track the clients.

Regards M.

I agree. Here's the link:
subject: Something wrong with lock() method signature ?
It's not a secret anymore!