Interface ServiceContainer

    • Method Detail

      • shutdown

        void shutdown()
        Stop all services within this container.
      • isShutdown

        boolean isShutdown()
        Whether container have been shut down.
        Returns:
        true if container is shutting down
      • isShutdownComplete

        boolean isShutdownComplete()
        Determine whether the container is completely shut down.
        Returns:
        true if shutdown is complete
      • addTerminateListener

        void addTerminateListener​(ServiceContainer.TerminateListener listener)
        Add a terminate listener to this container. The added listener will be invoked when this container shutdown process is complete.
        Parameters:
        listener - the listener
      • awaitTermination

        void awaitTermination()
                       throws InterruptedException
        Causes the current thread to wait until the container is shutdown.
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • awaitTermination

        void awaitTermination​(long timeout,
                              TimeUnit unit)
                       throws InterruptedException
        Causes the current thread to wait until the container is shutdown.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • awaitStability

        void awaitStability()
                     throws InterruptedException
        Causes the current thread to wait until the container is stable.
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • awaitStability

        boolean awaitStability​(long timeout,
                               TimeUnit unit)
                        throws InterruptedException
        Causes the current thread to wait until the container is stable.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Returns:
        true if this container achieved stability, false if the timeout elapsed before stability
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • awaitStability

        void awaitStability​(Set<? super ServiceController<?>> failed,
                            Set<? super ServiceController<?>> problem)
                     throws InterruptedException
        Causes the current thread to wait until the container is stable.
        Parameters:
        failed - a set into which failed services should be copied
        problem - a set into which problem services should be copied
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • awaitStability

        boolean awaitStability​(long timeout,
                               TimeUnit unit,
                               Set<? super ServiceController<?>> failed,
                               Set<? super ServiceController<?>> problem)
                        throws InterruptedException
        Causes the current thread to wait until the container is stable.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        failed - a set into which failed services should be copied
        problem - a set into which problem services should be copied
        Returns:
        true if this container achieved stability, false if the timeout elapsed before stability
        Throws:
        InterruptedException - if the current thread is interrupted while waiting
      • dumpServices

        void dumpServices()
        Dump a complete list of services to System.out.
      • dumpServices

        void dumpServices​(PrintStream stream)
        Dump a complete list of services to the given stream.
        Parameters:
        stream - the stream to which the service list should be written
      • getName

        String getName()
        Get the name of this service container.
        Returns:
        the container name