• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event Handler at client side

 
Manish Kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My idea is to implement a ConnectionEvent & its Listener at the client side.
The disconnect event should be fired whenever a database exception occurs and its event handler should be responsible for disabling the appropriate components and similar action should be taken by connect event to enable the components.
i want to know if i am right?. is there any one who has implemented their events?
please comment on it..
Thanks and regards
Manish Kumar
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manish,
I did. I had a ServerEventService which was bound to the RMI registry on the server. All remotely connected clients connected to this service before attempting to connect to the database connection service. After connecting to the service, the ServerEventService called setServerState on the client's interface to indicate whether or not the database connection service was running. Of course I created a ServerEvent which extended EventObject and implemented Serializable (for RMI transport). I had four event types: STARTUP, DELAYED_SHUTDOWN, SHUTDOWN and HEARTBEAT. STARTUP is self-explanatory, on a graceful server exit, first a DELAYED_SHUTDOWN was sent then after (an arbitrary) 60 second delay a SHUTDOWN event was sent. A HEARTBEAT event was sent (once again arbitrary) every 60 seconds for client confidence. If a client missed 5 consecutive HEARTBEAT events, it paniced, notified the user that the server connection was lost and locked the GUI so no further input, other than exit was possible.
Of course, doing all this was a lot of work and probably not necessary, but it may add a point or two to your score, who knows?
Hope this helps,
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic