public abstract class AbstractSystemService
extends com.google.common.util.concurrent.AbstractIdleService
| Modifier and Type | Field and Description |
|---|---|
protected Duration |
healthCheckInterval |
protected Consumer<String> |
outputSink |
protected Process |
process |
protected Thread |
shutdownHookThread |
| Constructor and Description |
|---|
AbstractSystemService() |
| Modifier and Type | Method and Description |
|---|---|
Duration |
getHealthCheckInterval() |
Consumer<String> |
getOutputSink() |
abstract boolean |
performHealthCheck()
Perform a health check on the service.
|
protected abstract ProcessBuilder |
prepareProcessBuilder()
Expected to return a properly configured ProcessBuilder instance,
such as having the path to the executable and the arguments set.
|
AbstractSystemService |
setHealthCheckInterval(Duration healthCheckInterval) |
AbstractSystemService |
setOutputSink(Consumer<String> outputSink) |
protected void |
shutDown() |
protected void |
startUp()
Starts the service and yields a future indicating whether it became
healthy within a certain time limit.
|
protected Duration healthCheckInterval
protected transient Process process
protected Thread shutdownHookThread
public AbstractSystemService setOutputSink(Consumer<String> outputSink)
public Duration getHealthCheckInterval()
public AbstractSystemService setHealthCheckInterval(Duration healthCheckInterval)
public abstract boolean performHealthCheck()
protected abstract ProcessBuilder prepareProcessBuilder()
protected void startUp()
throws IOException,
InterruptedException
startUp in class com.google.common.util.concurrent.AbstractIdleServiceIOExceptionInterruptedExceptionprotected void shutDown()
shutDown in class com.google.common.util.concurrent.AbstractIdleServiceCopyright © 2020. All rights reserved.