aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes lock and 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 "lock and unlock" Watch "lock and unlock" New topic
Author

lock and unlock

ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
I have developed a class called LockManager to handle the lock and unlock on the record.
I am removing the lock and unlock method in Data class and making it the responsibility of the LockManager.
Is my approach correct ?
My second question is about tracking the client id.
Can it be String type ?
I have read the postings on this forum where it is mentioned that remote reference for the client is taken for tracking the client.
How could it be done ?
Thanks
-- Ravindra


SCJP, SCJD, SCWCD, SCBCD, SCEA
James Du
Ranch Hand

Joined: Mar 23, 2001
Posts: 186
Hi, janapareddy
could you pls. elaborate your choice of LockManager here? why not simply use the lock and unlock of Data?
Thanks
-James
dhana sekar
Greenhorn

Joined: Feb 25, 2002
Posts: 21
Hello there is no need to remove the methods of Data class instred of that inherite Data class in your LockManager class and enjoy.
Like wise try to do locking and unlocking with out clientID
ersin eser
Ranch Hand

Joined: Feb 22, 2001
Posts: 1072
dhana
Please read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you for your cooperation.
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
James
I have developed the class LockManager so that lock and unlock could be encapsulated in this class and I also wanted to modify the lock and unlock method signature to accept record number and client id besides lock and unlock is not needed for local mode.
Iam not sure at this stage whether tracking a client is within the scope of the FBN assignment specifications.
Thanks
-- Ravindra
James Du
Ranch Hand

Joined: Mar 23, 2001
Posts: 186
hi janapareddy
As for the first issue, I still cant figue out the reason why you need to extract the lock and unlock methods and have that encapsulated in one separate LockManger class. if you find the method signatures unsuitable, why not add overloaded methods or make a wrapper for that? I dont mean to deny your choice, just have not see the justification of your choice.
the next issue, i dont think keeping track of clients is within the scope of the assignment if you accomplish the explicit requirements and handle the exceptions nicely. I guess in which way to that, it's up to the testers to decide.
-James
Travis Zimmerman
Greenhorn

Joined: Mar 06, 2002
Posts: 27
I believe the lock and unlock signatures are required to be in the Data class. I do not think there is a need to remove them regardless if you keep track of client or not.
I am tracking clients on the server without changing the method signatures in the Data class. Neither am I overriding those classes. I create a new instance of a dataserver giving it a new Data object for each client that connects. Doing it this way I can keep track of clients, validate that they can do a lock or unlock and then pass it on to the Data class.
I have done things this way to ensure that if a client tries to unlock a record he does not have a lock on, I will know about it and can return to the client without doing the unlock.
Travis Zimmerman
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Hi Guys
Thanks for the all the responses to my queries.
I have decided to provide implementation for lock / unlock methods in Data class only.
I have also decided to not track the client during lock / unlock as it is outside the scope of specifications .
However, I would need to add some additional methods in Data class to be used with Lock / UnLock and that would mean modification of Data class. I hope it is fine with the examiners.
Thanks
-- Ravindra
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Guys
After going through another query on lock / unlock has made me thinking again........
I personally would not like to touch any classes given by the Sun and rather would extend the class to give whatever desired behaviour I want for a method.
I would rather have a LockManager which extends Data and there I would give the desired method implementation.
Thanks
-- Ravindra
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: lock and unlock