Package org.jboss.msc

Interface Service

    • Field Detail

      • NULL

        static final Service NULL
        A simple null service whose start and stop methods do nothing.
    • Method Detail

      • start

        void start​(StartContext context)
            throws StartException
        Start the service. Do not return until the service has been fully started, unless an asynchronous service start is performed. All injections will be complete before this method is called.

        If the service start involves any activities that may block, the asynchronous mechanism provided by the context should be used. See the class javadoc for details.

        Parameters:
        context - the context which can be used to trigger an asynchronous service start
        Throws:
        StartException - if the service could not be started for some reason
      • stop

        void stop​(StopContext context)
        Stop the service. Do not return until the service has been fully stopped, unless an asynchronous service stop is performed. All injections will remain intact until the service is fully stopped. This method should not throw an exception.

        If the service start involves any activities that may block, the asynchronous mechanism provided by the context should be used. See the class javadoc for details.

        Parameters:
        context - the context which can be used to trigger an asynchronous service stop
      • newInstance

        static <V> Service newInstance​(Consumer<V> injector,
                                       V value)
        Factory for services providing single value.
        Type Parameters:
        V - provided value type
        Parameters:
        injector - target
        value - to assign
        Returns:
        new service instance