Class AbstractLifeCycle

    • Field Detail

      • STOPPED

        public static final java.lang.String STOPPED
      • FAILED

        public static final java.lang.String FAILED
      • STARTING

        public static final java.lang.String STARTING
      • STARTED

        public static final java.lang.String STARTED
      • STOPPING

        public static final java.lang.String STOPPING
    • Constructor Detail

      • AbstractLifeCycle

        public AbstractLifeCycle()
    • Method Detail

      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Method to override to start the lifecycle
        Throws:
        AbstractLifeCycle.StopException - If thrown, the lifecycle will immediately be stopped.
        java.lang.Exception - If there was a problem starting. Will cause a transition to FAILED state
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Method to override to stop the lifecycle
        Throws:
        java.lang.Exception - If there was a problem stopping. Will cause a transition to FAILED state
      • stop

        public final void stop()
                        throws java.lang.Exception
        Description copied from interface: LifeCycle
        Stops the component. The component may wait for current activities to complete normally, but it can be interrupted.
        Specified by:
        stop in interface LifeCycle
        Throws:
        java.lang.Exception - If the component fails to stop
        See Also:
        LifeCycle.isStopped(), LifeCycle.start(), LifeCycle.isFailed()
      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface LifeCycle
        Returns:
        true if the component is starting or has been started.
      • isFailed

        public boolean isFailed()
        Specified by:
        isFailed in interface LifeCycle
        Returns:
        true if the component has failed to start or has failed to stop.
      • getEventListeners

        public java.util.List<java.util.EventListener> getEventListeners()
      • setEventListeners

        public void setEventListeners​(java.util.Collection<java.util.EventListener> eventListeners)
      • addEventListener

        public boolean addEventListener​(java.util.EventListener listener)
        Specified by:
        addEventListener in interface LifeCycle
      • removeEventListener

        public boolean removeEventListener​(java.util.EventListener listener)
        Specified by:
        removeEventListener in interface LifeCycle
      • getState

        public static java.lang.String getState​(LifeCycle lc)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object