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 client ID for lock/unlock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "client ID for lock/unlock" Watch "client ID for lock/unlock" New topic

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
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.
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)

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

Java Regular Expressions
I agree. Here's the link:
subject: client ID for lock/unlock
It's not a secret anymore!