Class: PHXProcess
Last update: 16.07.2025Package: com.phoenix_int.aserver.util
Class Hierarchy
↳ java.lang.Object
↳ java.lang.Process
↳ com.phoenix_int.aserver.util.PHXProcess
Implemented Interfaces
com.phoenix_int.aserver.util.IPHXStreamRegExListener
Declaration
public class PHXProcess
extends java.lang.Process
implements com.phoenix_int.aserver.util.IPHXStreamRegExListener
This is a utility class that extends java.lang.Process with a system dependent process ID. This is combined with the phxspawn and phxps utilities to provide information on sub-processes in a semi-platform independent way.
Constructor Summary
| Constructor and Description |
|---|
PHXProcess(java.lang.Process p)Constructs a PHXProcess out of a regular process but does not provide extended functionality because the process ID will not be known. |
PHXProcess(java.lang.Process p, boolean readPID, java.lang.String jobIdRegex, java.lang.String jobNodeRegex, com.phoenix_int.aserver.util.IPHXProcessJobInfoListener listener) |
PHXProcess(java.lang.Process p, boolean readPID, java.lang.String jobIdRegex, java.lang.String jobNodeRegex, com.phoenix_int.aserver.util.IPHXProcessJobInfoListener listener, java.lang.String fname)Constructs a PHXProcess out of a process and optionally reads the PID of the sub-process. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
int |
exitValue() |
java.io.InputStream |
getErrorStream() |
java.io.InputStream |
getInputStream() |
java.lang.String |
getJobID() |
java.lang.String |
getJobNode() |
java.io.OutputStream |
getOutputStream() |
java.lang.Process |
getProcess()Returns the java Process instance for this PHXProcess |
int |
getProcessID()Returns the platform dependent process ID associated with this process. |
java.lang.String |
getTempScriptFileName() |
PHXProcessInfo[] |
listProcesses()This function lists all the processes and sub-processes of this PHXProcess. |
boolean |
matchFound(int patNum, Pattern pat, java.lang.String line, MatchResult match)Signals that a match was found. |
int |
waitFor() |
com.phoenix_int.aserver.util.PHXStreamRegExMonitor |
wrapErrorStream(com.phoenix_int.aserver.util.IPHXStreamRegExListener l) |
com.phoenix_int.aserver.util.PHXStreamRegExMonitor |
wrapInputStream(com.phoenix_int.aserver.util.IPHXStreamRegExListener l) |
Methods inherited from class java.lang.Process
destroyForcibly, isAlive, waitFor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
PHXProcess
public PHXProcess(java.lang.Process p,
boolean readPID,
java.lang.String jobIdRegex,
java.lang.String jobNodeRegex,
com.phoenix_int.aserver.util.IPHXProcessJobInfoListener listener,
java.lang.String fname)
Constructs a PHXProcess out of a process and optionally reads the PID of the sub-process. Typically you do not create instances of this class yourself, but use PHXRuntime.exec2() to generate instances.
Parameters:
readPID- If true, the PID of this process will be read off of the process's standard output. The pid should be a number and should be on the very first line of output all by itself.
PHXProcess
public PHXProcess(java.lang.Process p,
boolean readPID,
java.lang.String jobIdRegex,
java.lang.String jobNodeRegex,
com.phoenix_int.aserver.util.IPHXProcessJobInfoListener listener)
PHXProcess
public PHXProcess(java.lang.Process p)
Constructs a PHXProcess out of a regular process but does not provide extended functionality because the process ID will not be known. Use PHXRuntime to execute processes and automatically generate correct PHXProcess instances.
Method Detail
matchFound
public boolean matchFound(int patNum,
Pattern pat,
java.lang.String line,
MatchResult match)
Description copied from interface: com.phoenix_int.aserver.util.IPHXStreamRegExListener.
Signals that a match was found.
Specified by:
matchFoundin interfacecom.phoenix_int.aserver.util.IPHXStreamRegExListener
Parameters:
patNum- The index of the pattern that matchedpat- The matching patternline- The matching linematch- The MatchResult object which describes the match
Returns:
trueto continue searching for this pattern,falseto remove the pattern from the pattern list.
getJobID
public java.lang.String getJobID()
getJobNode
public java.lang.String getJobNode()
getProcess
public java.lang.Process getProcess()
Returns the java Process instance for this PHXProcess
getProcessID
public int getProcessID() throws java.io.IOException
Returns the platform dependent process ID associated with this process. If there was any error reading the process ID, or there is no process ID, an exception explaining the problem will be thrown (every time you call this function).
Throws:
java.io.IOException
listProcesses
public PHXProcessInfo[] listProcesses() throws java.io.IOException
This function lists all the processes and sub-processes of this PHXProcess. This is a suitable list to return from IPHXMonitorable.listProcesses().
Throws:
java.io.IOException
destroy
public void destroy()
Specified by:
destroyin classjava.lang.Process
exitValue
public int exitValue()
Specified by:
exitValuein classjava.lang.Process
waitFor
public int waitFor() throws java.lang.InterruptedException
Specified by:
waitForin classjava.lang.Process
Throws:
java.lang.InterruptedException
wrapInputStream
public com.phoenix_int.aserver.util.PHXStreamRegExMonitor wrapInputStream(com.phoenix_int.aserver.util.IPHXStreamRegExListener l)
wrapErrorStream
public com.phoenix_int.aserver.util.PHXStreamRegExMonitor wrapErrorStream(com.phoenix_int.aserver.util.IPHXStreamRegExListener l)
getInputStream
public java.io.InputStream getInputStream()
Specified by:
getInputStreamin classjava.lang.Process
getErrorStream
public java.io.InputStream getErrorStream()
Specified by:
getErrorStreamin classjava.lang.Process
getOutputStream
public java.io.OutputStream getOutputStream()
Specified by:
getOutputStreamin classjava.lang.Process
getTempScriptFileName
public java.lang.String getTempScriptFileName()