Package edu.wpi.grip.core.util.service
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 aService
that breaks the guarantee that theService.State.FAILED
andService.State.TERMINATED
states are terminal states. Instead, as long as the service is in a non running state the service can be started.
-
-
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 isService.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.
-
-
-
Method Detail
-
startAsync
RestartableService startAsync()
If the service state isService.State.NEW
,Service.State.FAILED
,Service.State.TERMINATED
this initiates service startup and returns immediately.- Specified by:
startAsync
in interfacecom.google.common.util.concurrent.Service
- Returns:
- this
- Throws:
java.lang.IllegalStateException
- if the service is not in one ofVALID_START_STATES
-
stopAsync
RestartableService stopAsync()
Stops the service.- Specified by:
stopAsync
in interfacecom.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
-
-