Interface RestartableService

  • All Superinterfaces:
    com.google.common.util.concurrent.Service
    All Known Implementing Classes:
    AutoRestartingService, CameraSource, PipelineRunner

    public interface RestartableService
    extends com.google.common.util.concurrent.Service
    This interface defines a Service that breaks the guarantee that the Service.State.FAILED and Service.State.TERMINATED states are terminal states. Instead, as long as the service is in a non running state the service can be started.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

        com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.google.common.collect.ImmutableSet<com.google.common.util.concurrent.Service.State> VALID_START_STATES  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      RestartableService startAsync()
      If the service state is Service.State.NEW, Service.State.FAILED, Service.State.TERMINATED this initiates service startup and returns immediately.
      void stopAndAwait()  
      void stopAndAwait​(long timeout, java.util.concurrent.TimeUnit unit)  
      RestartableService stopAsync()
      Stops the service.
      • Methods inherited from interface com.google.common.util.concurrent.Service

        addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, state
    • Field Detail

      • VALID_START_STATES

        static final com.google.common.collect.ImmutableSet<com.google.common.util.concurrent.Service.State> VALID_START_STATES
    • Method Detail

      • startAsync

        RestartableService startAsync()
        If the service state is Service.State.NEW, Service.State.FAILED, Service.State.TERMINATED this initiates service startup and returns immediately.
        Specified by:
        startAsync in interface com.google.common.util.concurrent.Service
        Returns:
        this
        Throws:
        java.lang.IllegalStateException - if the service is not in one of VALID_START_STATES
      • stopAsync

        RestartableService stopAsync()
        Stops the service.
        Specified by:
        stopAsync in interface com.google.common.util.concurrent.Service
        Returns:
        this
      • stopAndAwait

        void stopAndAwait()
      • stopAndAwait

        void stopAndAwait​(long timeout,
                          java.util.concurrent.TimeUnit unit)
                   throws java.util.concurrent.TimeoutException
        Throws:
        java.util.concurrent.TimeoutException