Class LifecycleParticipant

    • Constructor Detail

      • LifecycleParticipant

        public LifecycleParticipant()
    • Method Detail

      • addLifecycleListener

        @API(status=STABLE)
        public void addLifecycleListener​(LifecycleListener listener)

        Adds the specified life cycle listener to receive announcements when the component starts and stops. If listener is null or already present in the list of registered listeners, no exception is thrown and no action is performed.

        Lifecycle announcements are delivered to listeners on a separate thread to avoid worries about deadlock in synchronized start and stop methods. The called function should still be fast, or delegate long operations to its own separate thread.

        Parameters:
        listener - the device announcement listener to add
      • removeLifecycleListener

        @API(status=STABLE)
        public void removeLifecycleListener​(LifecycleListener listener)
        Removes the specified life cycle listener so that it no longer receives announcements when the component starts or stops. If listener is null or not present in the list of registered listeners, no exception is thrown and no action is performed.
        Parameters:
        listener - the life cycle listener to remove
      • getLifecycleListeners

        @API(status=STABLE)
        public Set<LifecycleListener> getLifecycleListeners()
        Get the set of lifecycle listeners that are currently registered.
        Returns:
        the currently registered lifecycle listeners
      • deliverLifecycleAnnouncement

        protected void deliverLifecycleAnnouncement​(org.slf4j.Logger logger,
                                                    boolean starting)
        Send a lifecycle announcement to all registered listeners.
        Parameters:
        logger - the logger to use, so the log entry shows as belonging to the proper subclass.
        starting - will be true if the DeviceFinder is starting, false if it is stopping.
      • isRunning

        @API(status=STABLE)
        public abstract boolean isRunning()
        Check whether this component has been started.
        Returns:
        the component has started successfully and is ready to perform any service it offers.