Class ProcessExecutionHandlerDefault
java.lang.Object
org.spincast.plugins.processutils.ProcessExecutionHandlerDefault
- All Implemented Interfaces:
HttpServerProcessHandlerExecutionHandler,ProcessExecutionHandler
- Direct Known Subclasses:
ProcessExecutionHandlerSync
public class ProcessExecutionHandlerDefault
extends Object
implements HttpServerProcessHandlerExecutionHandler
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Processprotected ProcessKillerCan benullif the process was not created.protected booleanbooleanReturnstrueif the process is alive;voidKill the process.voidonEnd()Always called at the end, whether the process exited or an exception occured.voidonExit(int exitCode) Called when the execution process exitsvoidCalled if an exception occured during the launch of the program.voidonSystemErr(String line) Called when a line is written to the standard errors by the created process.voidonSystemOut(String line) Called when a line is written to the standard output by the created process.voidCalled if the execution of the program exceeds the specified timeout.voidvoidsetProcessAndProcessKiller(Process process, ProcessKiller processKiller) Internal use.voidwaitForPortOpen(String host, int port, int nbrTry, int sleepMilliseconds) Wait for the specified host:port to be connectable.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
ProcessExecutionHandlerDefault
public ProcessExecutionHandlerDefault()
-
-
Method Details
-
getProcess
-
getProcessKiller
Can benullif the process was not created. -
isProcessAlive
public boolean isProcessAlive()Description copied from interface:ProcessExecutionHandlerReturnstrueif the process is alive;- Specified by:
isProcessAlivein interfaceProcessExecutionHandler
-
setProcessAndProcessKiller
Description copied from interface:ProcessExecutionHandlerInternal use.Will be called automatically when the process is created.
- Specified by:
setProcessAndProcessKillerin interfaceProcessExecutionHandler
-
isKillingRequested
protected boolean isKillingRequested() -
setKillingRequested
public void setKillingRequested() -
waitForPortOpen
public void waitForPortOpen(String host, int port, int nbrTry, int sleepMilliseconds) throws PortNotOpenException Description copied from interface:HttpServerProcessHandlerExecutionHandlerWait for the specified host:port to be connectable.- Specified by:
waitForPortOpenin interfaceHttpServerProcessHandlerExecutionHandler- Throws:
PortNotOpenException
-
killProcess
public void killProcess()Description copied from interface:ProcessExecutionHandlerKill the process.- Specified by:
killProcessin interfaceProcessExecutionHandler
-
onExit
public void onExit(int exitCode) Called when the execution process exits- Specified by:
onExitin interfaceProcessExecutionHandler
-
onLaunchException
Description copied from interface:ProcessExecutionHandlerCalled if an exception occured during the launch of the program.- Specified by:
onLaunchExceptionin interfaceProcessExecutionHandler
-
onEnd
public void onEnd()Description copied from interface:ProcessExecutionHandlerAlways called at the end, whether the process exited or an exception occured.- Specified by:
onEndin interfaceProcessExecutionHandler
-
onTimeoutException
public void onTimeoutException()Description copied from interface:ProcessExecutionHandlerCalled if the execution of the program exceeds the specified timeout.- Specified by:
onTimeoutExceptionin interfaceProcessExecutionHandler
-
onSystemOut
Description copied from interface:ProcessExecutionHandlerCalled when a line is written to the standard output by the created process.- Specified by:
onSystemOutin interfaceProcessExecutionHandler
-
onSystemErr
Description copied from interface:ProcessExecutionHandlerCalled when a line is written to the standard errors by the created process.- Specified by:
onSystemErrin interfaceProcessExecutionHandler
-