public abstract class AbstractProcess<T extends ExecutableProcessConfig,E extends Executable<T,P>,P extends IStopable> extends Object implements IStopable
| Modifier and Type | Field and Description |
|---|---|
static int |
TIMEOUT |
| Constructor and Description |
|---|
AbstractProcess(Distribution distribution,
T config,
RuntimeConfig runtimeConfig,
E executable) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
cleanupInternal() |
protected abstract List<String> |
getCommandLine(Distribution distribution,
T config,
ExtractedFileSet exe) |
T |
getConfig() |
protected Map<String,String> |
getEnvironment(Distribution distribution,
T config,
ExtractedFileSet exe) |
protected static int |
getPidFromFile(File pidFile) |
long |
getProcessId() |
boolean |
isProcessRunning() |
boolean |
isRegisteredJobKiller() |
protected void |
onAfterProcessStart(ProcessControl process,
RuntimeConfig runtimeConfig) |
protected void |
onAfterProcessStop(T config,
RuntimeConfig runtimeConfig) |
protected void |
onBeforeProcess(RuntimeConfig runtimeConfig) |
protected void |
onBeforeProcessStart(ProcessBuilder processBuilder,
T config,
RuntimeConfig runtimeConfig) |
protected File |
pidFile() |
protected File |
pidFile(File executableFile) |
protected boolean |
sendKillToProcess() |
protected boolean |
sendTermToProcess() |
protected void |
setProcessId(long processId) |
void |
stop() |
protected abstract void |
stopInternal() |
protected void |
stopProcess() |
protected boolean |
tryKillToProcess() |
int |
waitFor() |
int |
waitFor(long timeoutInMs) |
protected void |
writePidFile(File pidFile,
long pid) |
public static final int TIMEOUT
public AbstractProcess(Distribution distribution, T config, RuntimeConfig runtimeConfig, E executable) throws IOException
IOExceptionpublic boolean isRegisteredJobKiller()
isRegisteredJobKiller in interface IStopableprotected File pidFile()
public T getConfig()
protected void onBeforeProcess(RuntimeConfig runtimeConfig)
protected void onBeforeProcessStart(ProcessBuilder processBuilder, T config, RuntimeConfig runtimeConfig)
protected void onAfterProcessStart(ProcessControl process, RuntimeConfig runtimeConfig)
protected abstract List<String> getCommandLine(Distribution distribution, T config, ExtractedFileSet exe) throws IOException
IOExceptionprotected Map<String,String> getEnvironment(Distribution distribution, T config, ExtractedFileSet exe)
protected abstract void stopInternal()
protected abstract void cleanupInternal()
protected void onAfterProcessStop(T config, RuntimeConfig runtimeConfig)
protected final void stopProcess()
public int waitFor()
throws InterruptedException
InterruptedExceptionpublic int waitFor(long timeoutInMs)
throws InterruptedException
InterruptedExceptionprotected void setProcessId(long processId)
protected boolean sendKillToProcess()
protected boolean sendTermToProcess()
protected boolean tryKillToProcess()
public boolean isProcessRunning()
public long getProcessId()
protected static int getPidFromFile(File pidFile) throws IOException
IOExceptionprotected void writePidFile(File pidFile, long pid) throws IOException
IOExceptionCopyright © 2022. All rights reserved.