Class AbstractServiceController

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void clearDerivedService()  
      protected abstract void doPause()  
      protected abstract void doPause​(long timeout)  
      protected abstract void doResume()  
      protected abstract void doStart()  
      protected abstract void doStop()  
      protected java.lang.Object getLock()  
      java.lang.String getServiceName()
      Returns the name of this service.
      boolean isActive()
      Returns whether this service is currently started and active.
      boolean isBusy()
      Returns whether this service has any work in progress.
      protected abstract boolean isDerived()
      Returns whether this service is derived from another root service.
      protected void joinDerivedService​(ServiceController serviceController)  
      void pause()
      Pauses the service.
      void pause​(long timeout)
      Pauses the service for a specified period of time.
      void restart()
      Restarts the service.
      void restart​(java.lang.String message)
      Restarts the service.
      void resume()
      Continues the service after it has been paused.
      void setServiceStateListener​(ServiceStateListener serviceStateListener)
      Sets the service state listener.
      void start()
      Starts the service.
      void stop()
      Stops the service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractServiceController

        public AbstractServiceController​(boolean derivable)
    • Method Detail

      • getServiceName

        public java.lang.String getServiceName()
        Description copied from interface: ServiceController
        Returns the name of this service.
        Specified by:
        getServiceName in interface ServiceController
        Returns:
        the name of this service
      • joinDerivedService

        protected void joinDerivedService​(ServiceController serviceController)
      • clearDerivedService

        protected void clearDerivedService()
      • isDerived

        protected abstract boolean isDerived()
        Returns whether this service is derived from another root service.
        Returns:
        whether this service is derived
      • doStart

        protected abstract void doStart()
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doPause

        protected abstract void doPause()
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doPause

        protected abstract void doPause​(long timeout)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doResume

        protected abstract void doResume()
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doStop

        protected abstract void doStop()
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getLock

        protected java.lang.Object getLock()
      • start

        public void start()
                   throws java.lang.Exception
        Description copied from interface: ServiceController
        Starts the service.
        Specified by:
        start in interface ServiceController
        Throws:
        java.lang.Exception - if the service control fails
      • restart

        public void restart()
                     throws java.lang.Exception
        Description copied from interface: ServiceController
        Restarts the service.
        Specified by:
        restart in interface ServiceController
        Throws:
        java.lang.Exception - if the service control fails
      • restart

        public void restart​(java.lang.String message)
                     throws java.lang.Exception
        Description copied from interface: ServiceController
        Restarts the service.
        Specified by:
        restart in interface ServiceController
        Parameters:
        message - the message to be delivered to the system before restart
        Throws:
        java.lang.Exception - if the service control fails
      • pause

        public void pause()
                   throws java.lang.Exception
        Description copied from interface: ServiceController
        Pauses the service.
        Specified by:
        pause in interface ServiceController
        Throws:
        java.lang.Exception - if the service control fails
      • pause

        public void pause​(long timeout)
                   throws java.lang.Exception
        Description copied from interface: ServiceController
        Pauses the service for a specified period of time.
        Specified by:
        pause in interface ServiceController
        Parameters:
        timeout - the maximum time to wait in milliseconds.
        Throws:
        java.lang.Exception - if the service control fails
      • resume

        public void resume()
                    throws java.lang.Exception
        Description copied from interface: ServiceController
        Continues the service after it has been paused.
        Specified by:
        resume in interface ServiceController
        Throws:
        java.lang.Exception - if the service control fails
      • stop

        public void stop()
        Description copied from interface: ServiceController
        Stops the service. Destroys any services and resources that are dependent on this service.
        Specified by:
        stop in interface ServiceController
      • isActive

        public boolean isActive()
        Description copied from interface: ServiceController
        Returns whether this service is currently started and active.
        Specified by:
        isActive in interface ServiceController
        Returns:
        true, if the service is active; false otherwise
      • isBusy

        public boolean isBusy()
        Description copied from interface: ServiceController
        Returns whether this service has any work in progress.
        Specified by:
        isBusy in interface ServiceController
        Returns:
        true, if this service is busy; false otherwise