When the application registers the client workstation's event
manager as a handler of a specific remote event, the following occurs:
- The application invokes the registerInterestInRemoteEvent method
in the client workstation's event manager instance and passes the
following information as arguments:
- The event name
- The notifier name
- The context in which the operation registering the interest is
running
- If there is more than one session from the client to different
servers, the name of the Client/Server mechanism (Java Connector) instance that is managing the
session.
- The event manager instantiates an EventManagerClientOperation to
manage the communication between event managers on the client and
server workstations. The event manager then invokes the send method
of the appropriate Client/Server Mechanism instance to start the remote EventManagerServerOperation.
- On the server side, the Client/Server mechanism instantiates and
runs the EventManagerServerOperation.
- The remote operation's run method calls the addHandler method
of the server workstation's event manager and passes the event name,
the notifier name, and the Terminal Identifier (TID) of originating
workstation (set as an EventManagerServerOperation attribute
by the Client/Server Mechanism) as arguments.
- The server event manager then registers itself as a handler of
the specified event to the specified local notifier. The event manager
maintains the client TID in its remote events table (the workstationList
attribute) along with the name of the event and the event's notifier.
- When the notifier signals the event, the event manager's invoke
the sendEvent method in the Client/Server mechanism
passing the client workstation's TID as an argument. This ends the
EventManagerServerOperation's process and returns control to the Client/Server
Mechanism that started the operation.
- The Client/Server Mechanism creates a CSReplyEvent and sends it
as a reply to the client workstation.
- On the client workstation, the EventManagerClientOperation instance
is listening for a CSReplyEvent. When it receives this event, the
operation calls the receive method in the Client/Server Mechanism
and checks for the correct execution of the remote operation. The
client operation ends and the client event manager and regain control.
- The event manager can then notify the application of the remote
event.
When the application needs to send an event from the client
to the server, it can use the registerServerInterestInEvent of the
event manager to register the server workstation as a handler of the
event. In the event manager's events table, the server TID is replaced
by the identifier of the CSClient instance identifying the session
between the two workstations. When the notifier signals the event,
the EventManager's dispatch method sends the event to the workstation
identified by the CSClient instance.