Class ServiceControllerImpl.StartContextImpl

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StartContextImpl​(long startNanos)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void asynchronous()
      Call within the service lifecycle method to trigger an asynchronous lifecycle action.
      void complete()
      Call when either synchronous or asynchronous lifecycle action is complete.
      void execute​(java.lang.Runnable command)
      Execute a task asynchronously using the MSC task executor.
      void failed​(StartException reason)
      Call when start lifecycle action has failed for some reason.
      ServiceTarget getChildTarget()
      Get a service target which may be used to add child services.
      ServiceController<?> getController()
      Get the associated service controller.
      long getElapsedTime()
      Get the amount of time elapsed since the start or stop was initiated, in nanoseconds.
      • Methods inherited from class java.lang.Object

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

      • StartContextImpl

        private StartContextImpl​(long startNanos)
    • Method Detail

      • failed

        public void failed​(StartException reason)
                    throws java.lang.IllegalStateException
        Description copied from interface: StartContext
        Call when start lifecycle action has failed for some reason.
        Specified by:
        failed in interface StartContext
        Parameters:
        reason - the reason for the failure
        Throws:
        java.lang.IllegalStateException - if called after StartContext.complete() was called
      • getChildTarget

        public ServiceTarget getChildTarget()
        Description copied from interface: StartContext
        Get a service target which may be used to add child services. Child services have an implicit dependency on their parent, and are automatically removed when the parent service stops (or if the parent service fails during startup).

        Any listeners added directly to this service target will be added to child services when they are installed. Listeners added directly to this service target will be applied recursively to descendants as well, as long as the listener exists on this service target. To avoid this recursive behavior, apply listeners to any sub-target of this this target (see ServiceTarget.subTarget() for more information about sub-targets).

        Note that any listeners existing on the starting service are not applied to child services automatically; they must be explicitly added to the child service target.

        Specified by:
        getChildTarget in interface StartContext
        Returns:
        the child target
      • getElapsedTime

        public long getElapsedTime()
        Description copied from interface: LifecycleContext
        Get the amount of time elapsed since the start or stop was initiated, in nanoseconds.
        Specified by:
        getElapsedTime in interface LifecycleContext
        Returns:
        the elapsed time