org.opensolaris.os.dtrace
Class ProcessState

java.lang.Object
  extended by org.opensolaris.os.dtrace.ProcessState
All Implemented Interfaces:
java.io.Serializable

public final class ProcessState
extends java.lang.Object
implements java.io.Serializable

State of a target process designated by Consumer.createProcess(String command) or Consumer.grabProcess(int pid).

Immutable. Supports persistence using XMLEncoder.

See Also:
ConsumerListener.processStateChanged(ProcessEvent e), Serialized Form

Nested Class Summary
static class ProcessState.State
          State of a target process.
 
Constructor Summary
ProcessState(int pid, ProcessState.State processState, int processTerminationSignal, java.lang.String processTerminationSignalName, java.lang.Integer processExitStatus, java.lang.String msg)
          Creates a ProcessState instance with the given state.
ProcessState(int pid, java.lang.String processStateName, int processTerminationSignal, java.lang.String processTerminationSignalName, java.lang.Integer processExitStatus, java.lang.String msg)
          Supports XML persistence.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this ProcessState instance for equality.
 java.lang.Integer getExitStatus()
          Gets the process exit status.
 java.lang.String getMessage()
          Gets the message from DTrace describing this process state.
 int getProcessID()
          Gets the process ID.
 ProcessState.State getState()
          Gets the process state.
 int getTerminationSignal()
          Gets the signal that terminated the process.
 java.lang.String getTerminationSignalName()
          Gets the name of the signal that terminated the process.
 int hashCode()
          Overridden to ensure that equal instances have equal hash codes.
 java.lang.String toString()
          Gets a string representation of this process state useful for logging and not intended for display.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessState

public ProcessState(int pid,
                    ProcessState.State processState,
                    int processTerminationSignal,
                    java.lang.String processTerminationSignalName,
                    java.lang.Integer processExitStatus,
                    java.lang.String msg)
Creates a ProcessState instance with the given state.

Parameters:
pid - non-negative target process ID
processState - target process state
processTerminationSignal - signal that terminated the target process, -1 if the process was not terminated by a signal or if the terminating signal is unknown
processTerminationSignalName - name of the signal that terminated the target process, null if the process was not terminated by a signal or if the terminating signal is unknown
processExitStatus - target process exit status, null if the process has not exited or the exit status is unknown
msg - message included by DTrace, if any
Throws:
java.lang.NullPointerException - if the given process state is null
java.lang.IllegalArgumentException - if the given process ID is negative

ProcessState

public ProcessState(int pid,
                    java.lang.String processStateName,
                    int processTerminationSignal,
                    java.lang.String processTerminationSignalName,
                    java.lang.Integer processExitStatus,
                    java.lang.String msg)
Supports XML persistence.

Throws:
java.lang.IllegalArgumentException - if there is no ProcessState.State value with the given state name.
See Also:
ProcessState(int pid, State processState, int processTerminationSignal, String processTerminationSignalName, Integer processExitStatus, String msg)
Method Detail

getProcessID

public int getProcessID()
Gets the process ID.

Returns:
non-negative target process ID

getState

public ProcessState.State getState()
Gets the process state.

Returns:
non-null target process state

getTerminationSignal

public int getTerminationSignal()
Gets the signal that terminated the process.

Returns:
termination signal, -1 if the process was not terminated by a signal or if the terminating signal is unknown

getTerminationSignalName

public java.lang.String getTerminationSignalName()
Gets the name of the signal that terminated the process.

Returns:
termination signal name, null if the process was not terminated by a signal or if the terminating signal is unknown

getExitStatus

public java.lang.Integer getExitStatus()
Gets the process exit status.

Returns:
exit status, or null if the process has not exited or the exit status is unknown

getMessage

public java.lang.String getMessage()
Gets the message from DTrace describing this process state.

Returns:
DTrace message, or null if DTrace did not include a message with this process state

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this ProcessState instance for equality. Defines equality as having the same attributes.

Overrides:
equals in class java.lang.Object
Returns:
true if and only if the specified object is also a ProcessState and both instances have the same attributes

hashCode

public int hashCode()
Overridden to ensure that equal instances have equal hash codes.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Gets a string representation of this process state useful for logging and not intended for display. The exact details of the representation are unspecified and subject to change, but the following format may be regarded as typical:

 class-name[property1 = value1, property2 = value2]
 

Overrides:
toString in class java.lang.Object