This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes is it approved?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "is it approved??" Watch "is it approved??" New topic
Author

is it approved??

ilwyvd illtvd
Greenhorn

Joined: Oct 20, 2002
Posts: 13
I want design the data class provided by sun as
singleton mode,is it ok???and I also think it is doesn't matter in lock mode, you use clintId or remote dataObject as value,the only import thing is that you should ensure your hashtable key is recNumber.I have written a multi-threads class to test the lock methods, it runs Ok.
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
Data doesn't have to know that it's a "Singleton" or anything else. Your wrapper class (created by your server) will look to see if the Data class (which will be a static, or class-wide member of the wrapper class) has been created, and if not, it will create an instance of it).
The only value in using a ClientID with your LockManager (other than the fact that your code might subsequently be modified by a non-SCJD) is that a client could conceivable crash immediately after it's acquired a lock. Then the server must detect that 1) a client has died and 2) it held a lock on some record; then, the server must release that lock to allow "living" clients to continue.


Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
Ramesh kumaar
Ranch Hand

Joined: Mar 19, 2002
Posts: 146
Hi,
There is no need for singleton pattern in Data class, If DataServer class creates the instance of the Data class in the constructor, Which again instantiated inside the constructor of RemoteDBServer(for remoteAccess), which i belive will be called only once.
-rameshkumar
Ramesh kumaar
Ranch Hand

Joined: Mar 19, 2002
Posts: 146
Hi,
There is no need for singleton pattern in Data class, If DataServer class creates the instance of the Data class in the constructor, Which again instantiated inside the constructor of RemoteDBServer(for remoteAccess), which i belive will be called only once.
-rameshkumar
ilwyvd illtvd
Greenhorn

Joined: Oct 20, 2002
Posts: 13
Thank you for your answer,I understand it should
be guarantee only one data instance in wrapper class created by server to use data class,but how
can I know the client died,how the clientId connect with the client request.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is it approved??