public class ProcessExecutionHandlerDefault extends Object implements HttpServerProcessHandlerExecutionHandler
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
ProcessExecutionHandlerDefault() |
| Modifier and Type | Method and Description |
|---|---|
protected Process |
getProcess() |
protected ProcessKiller |
getProcessKiller()
Can be
null if the process
was not created. |
protected boolean |
isKillingRequested() |
boolean |
isProcessAlive()
Returns
true if the process is alive; |
void |
killProcess()
Kill the process.
|
void |
onEnd()
Always called at the end, whether the process
exited or an exception occured.
|
void |
onExit(int exitCode)
Called when the execution process exits
|
void |
onLaunchException(Exception ex)
Called if an exception occured during the launch
of the program.
|
void |
onSystemErr(String line)
Called when a line is written to the standard
errors by the created process.
|
void |
onSystemOut(String line)
Called when a line is written to the standard
output by the created process.
|
void |
onTimeoutException()
Called if the execution of the program
exceeds the specified timeout.
|
void |
setKillingRequested() |
void |
setProcessAndProcessKiller(Process process,
ProcessKiller processKiller)
Internal use.
|
void |
waitForPortOpen(String host,
int port,
int nbrTry,
int sleepMilliseconds)
Wait for the specified host:port to be connectable.
|
protected Process getProcess()
protected ProcessKiller getProcessKiller()
null if the process
was not created.public boolean isProcessAlive()
ProcessExecutionHandlertrue if the process is alive;isProcessAlive in interface ProcessExecutionHandlerpublic void setProcessAndProcessKiller(Process process, ProcessKiller processKiller)
ProcessExecutionHandlerWill be called automatically when the process is created.
setProcessAndProcessKiller in interface ProcessExecutionHandlerprotected boolean isKillingRequested()
public void setKillingRequested()
public void waitForPortOpen(String host, int port, int nbrTry, int sleepMilliseconds) throws PortNotOpenException
HttpServerProcessHandlerExecutionHandlerwaitForPortOpen in interface HttpServerProcessHandlerExecutionHandlerPortNotOpenExceptionpublic void killProcess()
ProcessExecutionHandlerkillProcess in interface ProcessExecutionHandlerpublic void onExit(int exitCode)
onExit in interface ProcessExecutionHandlerpublic void onLaunchException(Exception ex)
ProcessExecutionHandleronLaunchException in interface ProcessExecutionHandlerpublic void onEnd()
ProcessExecutionHandleronEnd in interface ProcessExecutionHandlerpublic void onTimeoutException()
ProcessExecutionHandleronTimeoutException in interface ProcessExecutionHandlerpublic void onSystemOut(String line)
ProcessExecutionHandleronSystemOut in interface ProcessExecutionHandlerpublic void onSystemErr(String line)
ProcessExecutionHandleronSystemErr in interface ProcessExecutionHandlerCopyright © 2019. All rights reserved.