File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes LockManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "LockManager" Watch "LockManager" New topic
Author

LockManager

Padmaja Prasad
Ranch Hand

Joined: Nov 14, 2001
Posts: 76
Hi,
After going thru some posts in this forum I understand that the LockManager is Singleton and can be instantiated by calling its getIntance() method. Now I have following doubts:
I. Where does it resides(in suncertify.server???) and where do we call that(in both DataAccessRemote and DataAccessLocal???)
2. Whether the methods, namely
lock(clientID,recNo)
and unlock(clientID,recNO) to be defined in this class??
Thanks
Padmaja
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Padmaja,

After going thru some posts in this forum I understand that the LockManager is Singleton ...

I don't want to get into a philosophical argument here but a LockManager is not necessarily a singleton. It absoulutely was not in my design.

I. Where does it resides(in suncertify.server???) and where do we call that(in both DataAccessRemote and DataAccessLocal???)

I put mine in the suncertify.db package, but I suppose it could go in suncertify.server just as well. No need to call it in local mode. My local implemetation had no-op versions of lock() and unlock() so just did nothing.

2. Whether the methods, namely
lock(clientID,recNo)
and unlock(clientID,recNO) to be defined in this class??

That's what I did and that seems to be the most appropriate in my opinion.
Hope this helps,
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

LockManager does not need to be a singleton. Just code you assignment so that there is only one instance. Just like the Data class.
As a bunch of us say here, Singleton pattern is way over used. and here is an instance where it is wrong to use it.
Hope that Helps.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LockManager