About RemoteData and RemoteDataFactory, need your help
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I have a ClientTableModel which get data from db though a RemoteData, the RemoteData is got from a RemoteDataFactory.
at the same time I have some ModifyButton , FindButton(which is command pattern, I think).. to execute command through RemoteData.
Are these RemoteData the same one? How can?
OR maybe I am wrong with my idea?
thank you for comment!
[ May 07, 2003: Message edited by: damu liu ]
[ May 07, 2003: Message edited by: damu liu ]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
1.when a client is writing record, can others read from the db.db?
2.can a client uses different RemoteDataImpl that get from a DataImplFactory to complete their task, say, read, write, find..?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You asked:
I have a ClientTableModel which get data from db though a RemoteData, the RemoteData is got from a RemoteDataFactory.
at the same time I have some ModifyButton , FindButton(which is command pattern, I think).. to execute command through RemoteData.
Are these RemoteData the same one? How can?
I dont understand what you are confused about. It sounds like you are on the right path lah. Your RemoteData class is providing the same methods as your data class isn't it? So to get the data you call the find and getRecord methods? So to do an update you would call the update method.
Does this make sense?
Other answers ...
1.when a client is writing record, can others read from the db.db?
The general consensus of the group seems to be that dirty reads are acceptable, and therefore we allow others to read while writes are in progress.
Note that this only happens internally within your server. It is not as though there are two servers running at the same time.
2.can a client uses different RemoteDataImpl that get from a DataImplFactory to complete their task, say, read, write, find..?
Is RemoteDataImpl your class on the server?
Are you asking if it should be a Singleton? - no, each client should get their own copy.
Are you asking if you need to do the work in creating a new instance of the server class? - no RMI should handle that for you.
Are you asking if one client can get an RMI connection and another get a direct connection? - no this would violate the instructions (in hotels) that tell us that only one application will access the database at any given time. If your instructions dont say this, dont worry - it is a safe bet. Catering for other eventualities is out of scope.
Regards, Andrew
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
So to get the data you call the find and getRecord methods? So to do an update you would call the update method.
Does this make sense?
Yes, I think so.
Are you asking if it should be a Singleton? - no, each client should get their own copy.
On the other hand, I want to konw if the RemoteData is a "multiton"
, I mean each client could get a RemoteData to read, another to find, another to write, each operation have a different RemoteData.Because the ClientConnection get the RemoteData from RemoteDataFactory, I suppose when I press update button,in the class UpdateButton I will get a RemoteData from ClientConnection at runtime, I don't think it is the same RemoteData which I get at runtime in my FindButton when the find button is pressed. am I right?
Are you asking if one client can get an RMI connection and another get a direct connection? - no this would violate the instructions (in hotels) that tell us that only one application will access the database at any given time. If your instructions dont say this, dont worry - it is a safe bet. Catering for other eventualities is out of scope.
You mean when one client is writing the db.db, the others that want to read the db.db have to wait?
Thank you once more.
Regards,
Damu
[ May 07, 2003: Message edited by: damu liu ]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
By passing the RemoteData as parameter to those object that need it, I think one RemoteData object can do all the work. Think you for comment.
[ May 08, 2003: Message edited by: damu liu ]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
On the other hand, I want to konw if the RemoteData is a "multiton"
, I mean each client could get a RemoteData to read, another to find, another to write, each operation have a different RemoteData.
Hmmm, this is close to what happens, however your next sentence makes me unsure whether what I understand you to be saying is what you are really saying
Because the ClientConnection get the RemoteData from RemoteDataFactory, I suppose when I press update button,in the class UpdateButton I will get a RemoteData from ClientConnection at runtime, I don't think it is the same RemoteData which I get at runtime in my FindButton when the find button is pressed. am I right?
I think what you are suggesting in that last sentence is something like this bad code:
The reason I think this is wrong is that it implies that you are getting a new connection for every action. You should not need to do this ... once you have a connection, you can use it again and again. Creating new connections will have quite a bit of overhead.
I think your next post also indicates that this was what you were doing, but you are rethinking it.
However my interpretation of your statement could be wrong, and what you could be stating is that with the following code:
The thread on the server which performed the read operation may be a different thread from the thread which performed the update.
If this is what you are trying to say, then yes, you are correct.
Andrew said:Are you asking if one client can get an RMI connection and another get a direct connection? - no this would violate the instructions (in hotels) that tell us that only one application will access the database at any given time. If your instructions dont say this, dont worry - it is a safe bet. Catering for other eventualities is out of scope.
Damu repliedYou mean when one client is writing the db.db, the others that want to read the db.db have to wait?
No, I think you can safely ignore my comment above. I could see several ways of reading your original question, and I tried to answer all of them - since you hadn't asked about running a client in direct connect mode while another client is connected via the network, you can ignore my comment.
But in answer to your question, I see no reason why a client doing a read should wait for a client doing a write to complete. Most people here seem to be of the opinion that dirty reads are out of scope (although many of them start by wondering about it).
Regards, Andrew
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thank you very much!
Damu
[ May 08, 2003: Message edited by: damu liu ]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I will answer your question here instead of result forum. I agree with Andrew's explaination.
I create the data instance(either local or remote) in the controller class, and this object will handle all your search, book ... Controller is a memeber variable of view class, data is a memeber variable of controller class, so there is only one data object for each client.
when a client is writing record, can others read from the db.db?
My understanding is there is nothing you need to do regarding read from the db.db. Only need to handle multiple database access when write vs. write.
Kevin
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thank you very much, your explanation is very helpful!
regards,
Damu
[ May 09, 2003: Message edited by: damu liu ]
| pie. tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |











