|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@ThreadSafe public interface EventListenerR
A remote event listener.
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.
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. |
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |