See: Description
Interface | Description |
---|---|
EventContext |
Contains methods for registering/deregistering listeners to be notified of
events fired when objects named in a context changes.
|
EventDirContext |
Contains methods for registering listeners to be notified
of events fired when objects named in a directory context changes.
|
NamespaceChangeListener |
Specifies the methods that a listener interested in namespace changes
must implement.
|
NamingListener |
This interface is the root of listener interfaces that
handle NamingEvents.
|
ObjectChangeListener |
Specifies the method that a listener of a NamingEvent
with event type of OBJECT_CHANGED must implement.
|
Class | Description |
---|---|
NamingEvent |
This class represents an event fired by a naming/directory service.
|
NamingExceptionEvent |
This class represents an event fired when the procedures/processes
used to collect information for notifying listeners of
NamingEvents threw a NamingException.
|
This package defines the event notification operations of the Java Naming and Directory InterfaceTM (JNDI). JNDI provides naming and directory functionality to applications written in the Java programming language. It is designed to be independent of any specific naming or directory service implementation. Thus a variety of services--new, emerging, and already deployed ones--can be accessed in a common way.
This package defines a NamingEvent class to represent an event that is generated by a naming/directory service. It also defines subinterfaces of Context and DirContext, called EventContext and EventDirContext, through which applications can register their interest in events fired by the context.
NamingEvent represents an event that occurs in a naming or directory service. There are two categories of naming events:
An application, for example, can register its interest in changes to objects in a context as follows:
EventContext src = (EventContext)(new InitialContext()).lookup("o=wiz,c=us"); src.addNamingListener("ou=users", EventContext.ONELEVEL_SCOPE, new ChangeHandler()); ... class ChangeHandler implements ObjectChangeListener { public void objectChanged(NamingEvent evt) { System.out.println(evt.getNewBinding()); } public void namingExceptionThrown(NamingExceptionEvent evt) { System.out.println(evt.getException()); } }
When a listener instance invokes NamingEvent.getEventContext(), it must take into account the possibility that other threads will be working with that context concurrently. Likewise, when a listener is registered via addNamingListener(), the registering thread must take into account the likely possibility that the service provider will later invoke the listeners in newly-created threads. As Context instances are not guaranteed to be thread-safe in general, all context operations must be synchronized as needed.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.