In Concordia, synchronous and asynchronous event notification for non-mobile objects are performed by EventNotifyImpl and EventQueueImpl, respectively. Both of these objects contain a reference to an EventHandler implementation. As mentioned earlier, EventHandler is an interface that defines one method, handleEvent, which is an application-specific event handler. Each Concordia object that receives events must implement its own event handler (i.e., the handleEvent method), which is passed an EventType object and performs the appropriate actions for that type of event.
Both EventNotifyImpl and EventQueueImpl also implement the EventPost interface, which defines the postEvent method for event notification. EventNotifyImpl provides a synchronous implementation of postEvent, whereas EventQueueImpl is an asynchronous implementation. Hence, when EventNotifyImpl's postEvent method receives an event, it immediately invokes handleEvent and the event is handled before the call returns. When EventQueueImpl receives an event, it queues it to be handled asynchronously by a separate thread. The EventQueueImpl's thread later dequeues the event and calls the event handler.
Typically, non-mobile objects use EventQueueImpl for notification. However, an EventNotifyImpl object should be used if it is necessary to handle events in the application's main thread of execution.
As discussed earlier, mobile agents set up event notification via Agent's makeEventHandler() method. This method encapsulates mobile event notification and it creates and manages either its own EventNotifyImpl or EventQueueImpl object. However, non-mobile objects must utilize the event notification objects directly.