Charles.<br />(SCJD2)
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Charles.<br />(SCJD2)
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Charles.<br />(SCJD2)
Charles.<br />(SCJD2)
Originally posted by Charles Dupin:
I mean a singleton pattern, with a public synchronized static Data getInstance() method, and synchronized add(), delete(), modify() methods.
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Charles.<br />(SCJD2)
Bad move. Please read my response in this thread.Originally posted by Charles Dupin:
Are you suggesting that there is no intelligence in the server, that you put all booking mechanism in the client. I was personnally ready to add a book() method to the remote stub that the clients call and put all the booking mechanism (locking, read and modify calls to db) in the server.
You're using a hammer on a screw; yeah, you'll get it into the wall alright, but it's shaky and you're ruining your wall. All you really want to achieve is a 1:1 relationship between a Data instance, a LockManager, and possibly something like a ConnectionFactory. There are perfectly well-known ways to model this, and Singleton is certainly not it -- rather, you'd use instance variables and/or factory methods to enforce the correct relationships between your objects. You might find this thread useful.To solve the Data singleton problem, create a DataInterface [...] singleton it, and connect it to the db.db file. Then Data is still available for reuse for other tables.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Charles.<br />(SCJD2)
Charles.<br />(SCJD2)
I am not sure how the instructions are worded these days. In my copy (3 years ago) the word "reuse" occurred a number of times.Originally posted by Charles Dupin:
I did not realized that Data was generic and supposed to be reused with other tables in the same server. It is very clear now.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Charles.<br />(SCJD2)
Originally posted by Charles Dupin:
BJ,
FBNData have no reference to an instance of Data. Just a sister class for the FBN db.db.
I am following you when you say that Sun's requirements was to make the methods of Data available in the client. But does it means that you put all the business in the client. I have all the Data methods available in the client, it could help Sun to test your locking system and thread safety with their own client application.
Charles.
A big clue here is that they call it a data server, not an application server.You must create a data server
Indeed. It's just a subtle nudge, as in: "You need to travel across the ocean. We're leaving you completely free as to the mode of transport you choose to use, but the vehicle you build must have a sail."Originally posted by BJ Grau:
When I read this requirement I had a hunch that Sun was trying to steer me in a certain direction.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Originally posted by Peter den Haan:
Indeed. It's just a subtle nudge, as in: "You need to travel across the ocean. We're leaving you completely free as to the mode of transport you choose to use, but the vehicle you build must have a sail."
Well, you can try submitting a plane with a sail, I guess
[ February 19, 2003: Message edited by: Peter den Haan ]
Charles.<br />(SCJD2)
Charles.<br />(SCJD2)
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Charles.<br />(SCJD2)
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |