wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes client ID for lock/unlock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "client ID for lock/unlock" Watch "client ID for lock/unlock" New topic
Author

client ID for lock/unlock

no more user
Ranch Hand

Joined: Aug 07, 2002
Posts: 39
i see this in instructions..
... If an attempt is made to unlock a record that has not been locked by this connection, then no action is be taken

to do this i have see many coments, such pass to the server a client object.. but, hm
i can do like this?
the server return a int by lock method wich identify this record locking order, and a subsequent unlock could pass this int with the recNum to unlock else the unlock no make effect, or have to be a same identifier for all time of connection of client..
i like java and
thanks in advance !
Ying Ren
Ranch Hand

Joined: May 24, 2002
Posts: 35
Hi,
I follow the popular solution, that you should create a lockmagager class in your server side. Since, the lock and unlock are only used in remote mode. And in your remote data class which should provide all the services that data class provides, you instance a new lockmanager class using this remote data class, thus, you can track the lock owner all the time.
YING REN
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Alex,
I agree with Ying that you should use a lock manager and OO methodology to map clients to locked records, but many have taken your approach and passed the certification. I would encourage you though to design it in such a way that you are not forced to change the signatures of lock and unlock in your public Data interface.
Hope this helps,
Michael Morris
[ August 07, 2002: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hi Alex,
You'll be able to find a detailed discussion of all issues regarding locking here
HTH,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4


Java Regular Expressions
 
GeeCON Prague 2014
 
subject: client ID for lock/unlock