Package org.glassfish.hk2.api
Interface InstanceLifecycleListener
- All Known Implementing Classes:
DefaultTopicDistributionService
This processor is called for certain events in the lifecycle of instances
of services.
This listener is concerned with instances of services, whereas the
ValidationService
is concerned with the descriptors for services.
An implementation of InstanceLifecycleListener must be in the Singleton scope.
Implementations of InstanceLifecycleListener will be instantiated as soon as
they are added to HK2 in order to avoid deadlocks and circular references.
Therefore it is recommended that implementations of InstanceLifecycleListener
make liberal use of Provider
or IterableProvider
when injecting dependent services so that these services are not instantiated
when the InstanceLifecycleListener is created
-
Method Summary
Modifier and TypeMethodDescriptionThis returns a filter that tells the system whether a particular descriptor should be handled by this lifecycle listener.void
lifecycleEvent
(InstanceLifecycleEvent lifecycleEvent) This method will be called when any lifecycle event occurs.
-
Method Details
-
getFilter
Filter getFilter()This returns a filter that tells the system whether a particular descriptor should be handled by this lifecycle listener. The filter can be called at any time- Returns:
- The filter that tells the system if this listener applies to this descriptor. If this returns null then this Listener will apply to ALL descriptors.
-
lifecycleEvent
This method will be called when any lifecycle event occurs. The currently supported lifecycle events are PRE_PRODUCTION, POST_PRODUCTION and PRE_DESTRUCTION. Code should be written to allow for future events to be generated. This method should not throw exceptions- Parameters:
lifecycleEvent
- The event that has occurred, will not be null
-