This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About RemoteData and RemoteDataFactory, need your help

 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question, could someone help me? thank you first:
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 ]
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
other questions:
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..?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Damu,
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
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Andrew,I am very glad that you can answer my queation, for after reading some issues you posted, I think we have many common opinions.
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 ]
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or maybe there is only one RemoteData object to complete all the task?
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 ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Damu,
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
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,
Thank you very much!
Damu
[ May 08, 2003: Message edited by: damu liu ]
 
Kevin Cao
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Damu,
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
 
Bigwood Liu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kevin,
Thank you very much, your explanation is very helpful!
regards,
Damu
[ May 09, 2003: Message edited by: damu liu ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic