textbender.g.util
Interface EventListenerR

All Superinterfaces:
EventListener, Remote
All Known Subinterfaces:
PropertyChangeListenerR
All Known Implementing Classes:
EnableButton, InPageHighlighter, InPagePointer, InPageStainer, PRTransferCHub

@ThreadSafe
public interface EventListenerR
extends Remote, EventListener

A remote event listener.

getSource() Behaviour of Events

For an EventObject e passed to a remote listener, e.getSource() will typically return null. This occurs because EventObject.source is a transient field, and most event types (subclasses of EventObject) do not bother to code its serialization. Rather they allow it to become null after e is serialized and unserialized, e.g. marshalled and unmarshalled through RMI, as it usually is by the time it gets to the remote listener.

Some event types may differ in this behaviour, especially those that are designed explicitly for remote listeners. But note: serializing a remote reference (as the event source often is, from the listener's perspective) might involve garbage collection complications (see link below). If it had to be serialized, it might be better to record it as a String or something that identifies the source by type (e.g. by class name) rather than by an instance reference.

In the typical case, the listener avoids e.getSource(). If the source is needed at event handling time, a reference is saved at registration time, beforehand.

See Also:
Is there any (ObjectStream sense) serializable remote ref in RMI?

Nested Class Summary
static class EventListenerR.WrapperL<R extends EventListenerR>
          A wrapper of a remote event listener that conforms it to an equivalent local type, by handling any remote exceptions.