java.lang.Object
com.aoindustries.aoserv.daemon.posix.PosixProcess
Direct Known Subclasses:
LinuxProcess

public abstract class PosixProcess extends Object
A PosixProcess represents a process running on any POSIX machine.
Author:
AO Industries, Inc.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    PosixProcess(int pid)
    Constructs a POSIX process given its process ID.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    Determines the group ID of a process.
    abstract int
    Determines the user ID of a process.
    abstract boolean
    Determines if the process is currently running.
    void
    Kills this process.
    void
    signal(String signalName)
    Sends a signal to this process.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • pid

      protected int pid
  • Constructor Details

    • PosixProcess

      protected PosixProcess(int pid)
      Constructs a POSIX process given its process ID.
  • Method Details

    • getGid

      public abstract int getGid() throws IOException
      Determines the group ID of a process. The subclasses of PosixProcess must implement this functionality. Calling the method on a PosixProcess will result in an IOException.
      Throws:
      IOException
    • getUid

      public abstract int getUid() throws IOException
      Determines the user ID of a process. The subclasses of PosixProcess must implement this functionality. Calling the method on a PosixProcess will result in an IOException.
      Throws:
      IOException
    • isRunning

      public abstract boolean isRunning() throws IOException
      Determines if the process is currently running. The subclasses of PosixProcess must implement this functionality. Calling the method on a PosixProcess will result in an IOException.
      Throws:
      IOException
    • killProc

      public void killProc() throws IOException, InterruptedException
      Kills this process. Sends a term signal once, waits two seconds, then sends a kill signal. The signals are sent to the execution of the /bin/kill executable.
      Throws:
      IOException
      InterruptedException
    • signal

      public void signal(String signalName) throws IOException
      Sends a signal to this process. The signals are sent to the execution of the /bin/kill executable.
      Throws:
      IOException