This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it approved??

 
ilwyvd illtvd
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 164
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic