Class Process
- java.lang.Object
-
- com.github.toolarium.system.command.dto.Process
-
- All Implemented Interfaces:
IProcess
- Direct Known Subclasses:
AsynchrounousProcess
public class Process extends java.lang.Object implements IProcess
Implements theIProcess
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedProcess(IProcessEnvironment processEnvironment, ISystemCommand systemCommand)Constructor for ProcessProcess(IProcessEnvironment processEnvironment, ISystemCommand systemCommand, java.lang.Long pid, java.time.Instant startTime, java.time.Duration totalCpuDuration, java.lang.Integer exitValue, java.io.OutputStream inputStream, java.io.InputStream outputStream, java.io.InputStream errorStream)Constructor for Process
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.io.InputStreamgetErrorStream()Get the standard error stream connected the process.java.lang.IntegergetExitValue()Get the exit value for the process.java.io.OutputStreamgetInputStream()Get the standard input stream connected the process.java.io.InputStreamgetOutputStream()Get the standard output stream connected the process.java.lang.LonggetPid()Get the process id.IProcessEnvironmentgetProcessEnvironment()Get the process environmentjava.time.InstantgetStartTime()Get the start time of the process.ISystemCommandgetSystemCommand()Get the system command of the process.java.time.DurationgetTotalCpuDuration()Get the total cpu time accumulated of the process.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Process
public Process(IProcessEnvironment processEnvironment, ISystemCommand systemCommand, java.lang.Long pid, java.time.Instant startTime, java.time.Duration totalCpuDuration, java.lang.Integer exitValue, java.io.OutputStream inputStream, java.io.InputStream outputStream, java.io.InputStream errorStream)
Constructor for Process- Parameters:
processEnvironment- the process environmentpid- the pidsystemCommand- the system commandstartTime- the start timetotalCpuDuration- the total cpu durationexitValue- the exist valueinputStream- the input streamoutputStream- the output streamerrorStream- the error stream
-
Process
protected Process(IProcessEnvironment processEnvironment, ISystemCommand systemCommand)
Constructor for Process- Parameters:
processEnvironment- the process environmentsystemCommand- the system command
-
-
Method Detail
-
getProcessEnvironment
public IProcessEnvironment getProcessEnvironment()
Description copied from interface:IProcessGet the process environment- Specified by:
getProcessEnvironmentin interfaceIProcess- Returns:
- the process environment
- See Also:
IProcess.getProcessEnvironment()
-
getSystemCommand
public ISystemCommand getSystemCommand()
Description copied from interface:IProcessGet the system command of the process.- Specified by:
getSystemCommandin interfaceIProcess- Returns:
- the system command of this process
- See Also:
IProcess.getSystemCommand()
-
getPid
public java.lang.Long getPid()
Description copied from interface:IProcessGet the process id.- Specified by:
getPidin interfaceIProcess- Returns:
- the native process id of the process or null if unknown
- See Also:
IProcess.getPid()
-
getInputStream
public java.io.OutputStream getInputStream()
Description copied from interface:IProcessGet the standard input stream connected the process.- Specified by:
getInputStreamin interfaceIProcess- Returns:
- the standard input stream connected to the process
- See Also:
IProcess.getInputStream()
-
getOutputStream
public java.io.InputStream getOutputStream()
Description copied from interface:IProcessGet the standard output stream connected the process.- Specified by:
getOutputStreamin interfaceIProcess- Returns:
- the standard output stream connected to the process
- See Also:
IProcess.getOutputStream()
-
getErrorStream
public java.io.InputStream getErrorStream()
Description copied from interface:IProcessGet the standard error stream connected the process.- Specified by:
getErrorStreamin interfaceIProcess- Returns:
- the error stream connected to the process
- See Also:
IProcess.getErrorStream()
-
getStartTime
public java.time.Instant getStartTime()
Description copied from interface:IProcessGet the start time of the process.- Specified by:
getStartTimein interfaceIProcess- Returns:
- the start time of the process
- See Also:
IProcess.getStartTime()
-
getTotalCpuDuration
public java.time.Duration getTotalCpuDuration()
Description copied from interface:IProcessGet the total cpu time accumulated of the process.- Specified by:
getTotalCpuDurationin interfaceIProcess- Returns:
- the accumulated total cpu time
- See Also:
IProcess.getTotalCpuDuration()
-
getExitValue
public java.lang.Integer getExitValue()
Description copied from interface:IProcessGet the exit value for the process.- Specified by:
getExitValuein interfaceIProcess- Returns:
- the exit value of the process, by convention, the value
0indicates normal termination. It return null if it has not exit by now. - See Also:
IProcess.getExitValue()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-