public abstract class DaemonRunner<S> extends Object
| Constructor and Description |
|---|
DaemonRunner() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract String |
getDaemonShortName() |
protected abstract void |
killImpl(S stat) |
protected abstract S |
readStatusFromDisk() |
static void |
runCommand(String... argv)
Run the parameter as an external process.
|
S |
start()
Read daemon status from disk, then try to start the daemon
if the status file says it is stopped.
|
protected abstract S |
startImpl() |
void |
stop()
Read daemon status from disk, then try to kill the daemon
if the status file says it is running.
|
protected abstract String getDaemonShortName()
protected abstract void killImpl(S stat) throws IOException
IOExceptionprotected abstract S startImpl() throws IOException
IOExceptionprotected abstract S readStatusFromDisk()
public S start()
startImpl(), register a shutdown hook with the VM
that will call killImpl(S) on shutdown.public void stop()
public static void runCommand(String... argv)
argv - passed directly to ProcessBuilder's constructorCopyright © 2012–2024. All rights reserved.