Listeners register an interest in a target object or objects. The context might not yet have a binding for the target, and it is optional whether a context will support registering for events about an object that is not bound. If the context does not support it then addNamingListener()
should throw a NameNotFoundException
. Alternatively, if this is not possible, the EventContext
should send the listener a NamingExceptionEvent
with the information. A NamingExceptionEvent
is also used to notify listeners who have registered interest in a target that is subsequently deleted, if the context only allows registration for currently bound objects.
Listeners can register for events affecting the context itself, which as usual is referred to by the empty name.
When a listener receives a NamingExceptionEvent
it is deregistered.
When Context
.closed is called on an EventContext
, all of its listeners are deregistered.
Listener implementations may choose to implement more than one sub-interface of NamingListener
, in order to be notified of more than one type of event.
Event context implementations are not expected to be thread safe.
|
|
|
|
|
|
|
|
|
|