It is required that JNDI be notified when a lazily bound object is removed from the environment so that it can be sure to unbind the object from the JNDI registry. This requirement will be met by registering a listener with the extension registry which will notify JNDI when new objects are registered and also when currently registered objects are unregistered. When this notification occurs the JNDI provider will add the new object or remove the existing object from its registry.
It is the responsibility of the JNDI provider to manage the lifecycle of the binding, not of the instantiated object. The ObjectFactory
implementation is responsible for managing the lifecycle of the created object by registering any appropriate listeners, and managing the cleanup of any associated resources if the contributing bundle artifact is de-activated. It may do so by registering its own Extension Registry listener (org.eclipse.core.runtime.IRegistryChangeListener
) for the exposed extension point.
Parent topic: Extending declarative JNDI: XPD622