• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: should data update broadcasted to all users?

 
YungSheng Chang
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scenario1:
Client A, B, C connect to server. Client A updates record 5 first. Should this update be broadcasted to Client B, C automatically?
Yes in the real world of course this should be implemented. However, since it is not a "must" in Sun instruction, is it allowable to implement it in another way?
To implement it, the server must maintain client list, and refresh function should be included in rmi. I would like to listen to your opinion, thanks!
Scenario2:
Client A, B, C connect to server. Server shuts down. Should this be reflected to client, or leave it when the client executes any action?
 
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 YungSheng,
I think it is not necessary to broadcast updates in this assignment, and often it is not necessary in real life.
Broadcasting updates is a nice feature while you have a small number of clients connected. But as the number grows, the amount of network traffic that will be generated will be enormous.
Consider a normal hotel reservation system - you should be able to reserve a hotel today from anywhere in the world. Just go into your local travel agent, or search on the web, find the hotel, and book it. Now reverse that scenario: each hotel reservation system would have to send updates to every connected travel agent and every connected web client anywhere in the world!
Nowhere in the specification does it require you to update all connected clients. So make life easier for yourself and leave it out. If you want to, put a comment in the design decisions document saying that you considered it and rejected it - that way you do show that you at least considered the idea.
But if you want to implement it, then it can be an interesting exercise - you will certainly learn more about RMI and using the Observable pattern over RMI than if you leave it out .
Regards, Andrew
[ January 08, 2004: Message edited by: Andrew Monkhouse ]
 
YungSheng Chang
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I am so happy to hear Andrew say "it is not necessary", which means I am much closer to my submission.
I've been observing this bulletin for quite a long time and found no discussion about broadcasting. It is not mentioned in Habibi's book either. I think most people do here not implement it, and this apparantly does not effect SCJD certification.
In my school assignment, we did implement network broadcasting. It is a nice feature to have when you want to keep client board always update.
Think of a lazy client who does not refresh his screen for one day. Before the screen was refresed, Hotel A was available. But within that day, Hotel A was taken by somebody else. That lazy client still presses the "Book" button and overwrite the record. This will bring a lot of customer complain!!
 
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 YungSheng,
Originally posted by YungSheng Chang:
Think of a lazy client who does not refresh his screen for one day. Before the screen was refresed, Hotel A was available. But within that day, Hotel A was taken by somebody else. That lazy client still presses the "Book" button and overwrite the record. This will bring a lot of customer complain!!

Ahh, but you still have to make your bookings safe, regardless of whether you provide client updates. Consider:
  • Client A books record 5
  • Client B books record 5
  • Client A's booking suceeds (and all clients notified)


  • In this case, even though client B is getting notified, it still has an outstanding booking request. So you still have to validate that this second booking cannot take place.
    Regards, Andrew
     
    YungSheng Chang
    Ranch Hand
    Posts: 44
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yes, therefore isBookable(long recNo) is implemented on server side, not client side.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic