Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about callback of model state change

 
xiangyang li
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should I refresh each client if the model state change?if should,the DBAccess Interface specified by Sun has no method such as addChangeListener(View v),how can I add each View to the model?appreciate your reply.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11945
212
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi xiangyang li,

Welcome to JavaRanch and this forum.

There is no requirement for this, and it is not something that is typically done in real life - consider a real reservation system (hotel / airline / ...): there is no way that they would update the millions of connected clients every time a customer makes a booking.

If you did want to do this, you might want to consider the fact that your Data class must implement a specified interface, but there is nothing to say that it cannot implement other interfaces or have extra methods as well .

Regards, Andrew
 
xiangyang li
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks,
I will extend my DBAccess Interface.
But I think that it is necessary for this especially in real time system.In a small C/S system,there isn't many clients.In Sun's SCJD teaching material,they have finished this.Observer design pattern can also help us.
I am sorry that I am beginner in English,it takes you more time to understand what I said.
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry that I am beginner in English
Your English is better than many people I know who claim English as their first language.

As far as the Observer pattern, I am considering implementing it as well. Given the relatively small number of clients expected for this application, it would be a practical decision. I have B&S 2.2.3, and my specification states that the client will be used only by a team of Customer Service Reps, and "The IT director does not anticipate much reuse of the first Java technology system, but intends to use that system as a learning exercise before going on to a web based system."

Has anyone used the Observer pattern with RMI before?
 
Itapaj� Takeguma
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will extend my DBAccess Interface.


I asked sun if I could insert a method getScheme in BBMain interface, they said I MUST not insert or remove methods of this interface.

About update the client when the data base changes (my assignemt is that of CSR of Scarper LCC...), when the user presses the book button, first I try to lock, then I read the record and update the table acordingly.

well, that's it.
Itapaj� Takeguma.
SCJD in progress....
 
xiangyang li
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked sun if I could insert a method getScheme in BBMain interface, they said I MUST not insert or remove methods of this interface.

I didn't express my meaning clearly,I mean that I create a new Interface that extends DBAccess.

when the user presses the book button,lock and read the latest record,I think that It is also a choice.thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic