NCSAHabanero

[ Previous ] [ Index ] [ Next ]

-------------------------------------------------------------------
How events work in Habanero
-------------------------------------------------------------------

Habanero's Event Model

Background Information

There are several ways to implement the kind of synchronous collaboration we want in Habanero.

One way is to keep track of all the events that have occurred since a hablet starts up, and if a new client joins the session, to replay all those events. However, this is not the way that Habanero implements synchornous collaboration, because this method could take a long time to replay all the events, especially if they generate a lot of calculation.

Instead, Habanero sends the current state of the existing hablets to new clients that join the session. Habanero then sends any new events to all clients. The drawback of this approach is that hablets need to know how to package up their internal state to make that state available for sending to other clients. The advantage is that new joining clients immediately reach the same state as the other clients.

How does this work?

A. New client joining session

When a new client joins a session, Habanero requests an existing client to package up its internal state for Habanero to send to the new client. This is called serialization.

Here is an example of this process in diagram form:

 Diagram of a state transfer example.

B. New event while clients are running

When a user does something that generates an event that you have told Habanero to share, Habanero intercepts the event and sends it to all the clients so that they all do the same thing.

Here is an example of this process in diagram form:
Diagram of an event-sharing example.
1. The user Ian types "Oh, when the saints" and presses return like before.
2. Because this generates an ActionEvent, and because we had earlier registered ActionEvents to be propogated, the event is sent to Habanero instead of to Ian's FieldListener.
3. Habanero calls actionPerformed() in both Ian's and Sven's FieldListeners.
Event Example part 2
4. The two actionPerformed()s get the data from the event and put it in their respective outAreas.

What next?

Read Transfer State to Other Instances to see how to do part A, and Simple Event Handling to see how to do part B.


Habanero® is a registered trademark owned by The Board of Trustees of the University of Illinois. Copyright 1996-1998. All rights reserved.   Java(TM) is a proprietary trademark owned by Sun Microsystems, Inc.
NCSA
The National Center for Supercomputing Applications

University of Illinois at Urbana-Champaign

Contacts page