Class LoggingProcess
java.lang.Object
org.eblocker.server.common.system.LoggingProcess
- Direct Known Subclasses:
LoggingProcessUnix
A wrapper for processes that should log their stout and stderr streams.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintabstract intgetPid()booleanisAlive()Retrieves next line of output, or returnsnullif there is none.voidvoidStarts a process with the given argumentsRetrieves next line of output, waiting if necessary until output becomes available or returns null if process has quit.intwaitFor()Wait for the process to terminate.
-
Field Details
-
name
-
process
-
-
Constructor Details
-
LoggingProcess
Creates a process- Parameters:
name- name to be shown at the start of each log line
-
-
Method Details
-
start
Starts a process with the given arguments- Parameters:
args-- Throws:
IOException
-
run
- Throws:
IOExceptionInterruptedException
-
isAlive
public boolean isAlive() -
waitFor
Wait for the process to terminate.- Returns:
- the exit value of the process
- Throws:
InterruptedException
-
getPid
public abstract int getPid() -
exitValue
public int exitValue() -
pollStdout
Retrieves next line of output, or returnsnullif there is none. -
takeStdout
Retrieves next line of output, waiting if necessary until output becomes available or returns null if process has quit.- Throws:
InterruptedException
-