Class Processes

java.lang.Object
org.zeroturnaround.process.Processes

public class Processes extends Object
Creates SystemProcess instances.
  • Constructor Details

    • Processes

      public Processes()
  • Method Details

    • newStandardProcess

      public static SystemProcess newStandardProcess(Process process)
      Creates an instance that represents the given Process by detecting its PID using both, Process object and external tools. Java APIs are tried before using the external tools.
      Parameters:
      process - instance of an existing process started from JVM.
      Returns:
      system process that represents the given input as described above.
    • newStandardProcess

      public static SystemProcess newStandardProcess(Process process, int pid)
      Creates an instance that represents the given Process or the given PID. They are expected to belong to the same system process. Java APIs are tried before using the external tools (PID value).
      Parameters:
      process - instance of an existing process started from JVM.
      pid - PID of the same process.
      Returns:
      system process that represents the given input as described above.
    • newJavaProcess

      public static JavaProcess newJavaProcess(Process process)
      Creates an instance that represents the given Process object.
      Parameters:
      process - instance of an existing process started from JVM.
      Returns:
      system process that represents the given input as described above.
    • newPidProcess

      public static PidProcess newPidProcess(Process process)
      Creates an instance that represents the PID value of the given Process. The instance uses external tools for killing the process.
      Parameters:
      process - instance of an existing process started from JVM.
      Returns:
      system process that represents the given input as described above.
    • newPidProcess

      public static PidProcess newPidProcess(int pid)
      Creates an instance that represents the given PID value. The instance uses external tools for killing the process.
      Parameters:
      pid - PID of an external process (running or not).
      Returns:
      system process that represents the given input as described above.
    • newProcessWithAtlernatives

      public static SystemProcess newProcessWithAtlernatives(SystemProcess... processes)
      Combines existing SystemProcess objects as alternative implementations for a single process.
      Parameters:
      processes - alternative process instances that represent a single process.
      Returns:
      system process that represents the given inputs as described above.
    • newProcessWithAlternatives

      public static SystemProcess newProcessWithAlternatives(SystemProcess... processes)
      Combines existing SystemProcess objects as alternative implementations for a single process.
      Parameters:
      processes - alternative process instances that represent a single process.
      Returns:
      system process that represents the given inputs as described above.
    • newProcessForMultiple

      public static SystemProcess newProcessForMultiple(SystemProcess... processes)
      Combines existing SystemProcess objects for multiple processes.
      Parameters:
      processes - process instances that represent different processes.
      Returns:
      system process that represents the given inputs as described above.