Class ProcessUtils

java.lang.Object
org.apache.jena.dboe.sys.ProcessUtils

public class ProcessUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getPid(int fallback)
    Tries to get the PID of the current process caching it for future calls since it won't change throughout the life of the process
    static boolean
    isAlive(int pid)
    Determines whether a given PID is alive
    static boolean
    Gets whether the platform we are running on will cause us to treat negative (i.e.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProcessUtils

      public ProcessUtils()
  • Method Details

    • getPid

      public static int getPid(int fallback)
      Tries to get the PID of the current process caching it for future calls since it won't change throughout the life of the process
      Parameters:
      fallback - Fallback PID to return if unable to determine the PID i.e. an error code to return
      Returns:
      PID of current process or provided fallback if unable to determine PID
    • isAlive

      public static boolean isAlive(int pid)
      Determines whether a given PID is alive
      Parameters:
      pid - PID
      Returns:
      True if the given PID is alive or unknown, false if it is dead
    • negativePidsTreatedAsAlive

      public static boolean negativePidsTreatedAsAlive()
      Gets whether the platform we are running on will cause us to treat negative (i.e. invalid) PIDs as alive because of the format in which the command line process monitor application for the system returns errors for invalid PIDs
      Returns:
      True if a negative PID is treated as alive on this platform or we cannot determine liveness for PIDs on this platform, false otherwise