• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tell Clients a Record is locked/updated?

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I have implemented RMI in my UrlyBird project, and when a client connects they get a list of Booking objects and these are displayed in the GUI. (similar to the implementation used in the SCJD Exam book). These booking objects are a COPY of the booking objects on the server (The Booking objects implement Serializable)

What I would like to do though, is when a client updates a record is for the server to send out an Event object (or something similar) to all the clients connected, telling them that Record number nn has been updated - get a fresh copy of this record and redisplay on the GUI. Also when a Booking is locked, for the record on screen to be greyed out (for example)

(The implementation in the SCJD book waits for each client to do something, and then goes to the server to get a list of ALL records).

I've looked through the posts on this forum, but could'nt find anything relating to my query.

Can anyone help me out?

Regards
Phil
[ June 23, 2004: Message edited by: Phil Harron ]
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are talking about would require a great deal of bandwidth and is also computationally intensive. Every time a user updates a record, the server has to connect to every client and send them information over the network. Every client will then make a new request for a fresh view over the network and then the server will again have to communicate with every client over the network to send them the updated information. Imagine 200 clients! Not only does that require a lot of bandwidth, but it also requires a lot of processing to be done on the server. Also, if the client is constantly being harrassed to refresh its records, it will be less responsive to the user. Finally, say there are 10,000 records in the database. Each client is probably only concerned with at most a few of them and should not be bothered with updates to irrelevant records.

For these reasons, I think that you should not follow through with this update notification idea. Just a suggestion
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you really wanted to notify all clients of certain events, you could use a MulticastSocket.
 
Phil Harron
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with your comments Anthony - much appreciated. One point though - surely this is the way real world applications might work? I know they would have more processing power and bandwidth, but how much bandwidth would it take to send an event object down the wire (only holding the recNo of the booking to refresh) to the client. What about the example in the SCJD book, if it had 200 clients who were all doing an update/refresh constantly . I might just try to do this anyway and see how it copes/what happens in both applications.

Do you think then its enough to leave the Server/Gui as is then and when the Client does something it does a refresh?

Thanks again
Phil
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any need to perform a refresh if you do not know for sure that the client's data is stale? Is there any need to refresh if the client is not modifying a record?

I believe that in the real world it is uncommon for servers to notify remote clients of events because of bandwidth and scalability issues.
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic