Class MacProcesses


  • public class MacProcesses
    extends java.lang.Object
    Collection of static methods to check for running processes on macOS and terminate them.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MacProcesses.Info
      Class that holds information about running macOS processes.
    • Constructor Summary

      Constructors 
      Constructor Description
      MacProcesses()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean areInstalledLaunchersRunning()
      Determine if any of the installed launchers are currently running.
      static MacProcesses.Info[] getRunningProcesses()
      Get a list of all running processes the installer can see.
      static boolean terminateProcesses​(int[] processIds, boolean force, int timeout)
      Tries to close the processes with the given ids by sending a VM_CLOSE message to all visible top-level windows.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MacProcesses

        public MacProcesses()
    • Method Detail

      • getRunningProcesses

        public static MacProcesses.Info[] getRunningProcesses()
        Get a list of all running processes the installer can see.
        Returns:
        info objects with module name, process id and further information
      • terminateProcesses

        public static boolean terminateProcesses​(int[] processIds,
                                                 boolean force,
                                                 int timeout)
        Tries to close the processes with the given ids by sending a VM_CLOSE message to all visible top-level windows.
        Parameters:
        processIds - the processes to terminate
        force - if the process should be killed with kill -9
        timeout - the maximum time to wait for the processes to terminate after the message has been sent in milliseconds. The minimum time is 400 ms regardless of a lower setting.
        Returns:
        true if all processes have been terminated.
      • areInstalledLaunchersRunning

        public static boolean areInstalledLaunchersRunning()
        Determine if any of the installed launchers are currently running. All launchers in the currently set installation directory are checked. The "Install Files" action performs this check by default and warns the user that processes are running. With this method you can check for this condition earlier in your installer.
        Returns:
        true or false.