}
// extract the listener id from the remote event and find
// the locally registered event listener
Long id = new Long(remoteEvent.getListenerId());
EventListener listener = (EventListener) listenerMap.get(id);
// if the listener is not registered (anymore), the event is
// silently ignored, running is checked and the server asked again
if (listener == null) {
continue;
}
// otherwise convert the remote events into an EventIterator
// and the listener is called
RemoteEventCollection.RemoteEvent[] remoteEvents = remoteEvent.getEvents();
EventIterator events = toEvents(remoteEvents);
try {
listener.onEvent(events);
} catch (Exception e) {
log.error("Unexpected failure of Listener " + listener, e);
}
} catch (RemoteException re) {