Class PpidChecker


  • final class PpidChecker
    extends java.lang.Object
    Recognizes PID of Plugin process and determines lifetime.
    Since:
    2.20.1
    • Field Detail

      • WMIC_CREATION_DATE_VALUE_LENGTH

        private static final int WMIC_CREATION_DATE_VALUE_LENGTH
        See Also:
        Constant Field Values
      • WMIC_CREATION_DATE_TIMESTAMP_LENGTH

        private static final int WMIC_CREATION_DATE_TIMESTAMP_LENGTH
        See Also:
        Constant Field Values
      • WMIC_CREATION_DATE_FORMAT

        private static final java.text.SimpleDateFormat WMIC_CREATION_DATE_FORMAT
      • WMIC_CREATION_DATE

        private static final java.lang.String WMIC_CREATION_DATE
        See Also:
        Constant Field Values
      • WINDOWS_SYSTEM_ROOT_ENV

        private static final java.lang.String WINDOWS_SYSTEM_ROOT_ENV
        See Also:
        Constant Field Values
      • RELATIVE_PATH_TO_WMIC

        private static final java.lang.String RELATIVE_PATH_TO_WMIC
        See Also:
        Constant Field Values
      • SYSTEM_PATH_TO_WMIC

        private static final java.lang.String SYSTEM_PATH_TO_WMIC
        See Also:
        Constant Field Values
      • destroyableCommands

        private final java.util.Queue<java.lang.Process> destroyableCommands
      • UNIX_CMD_OUT_PATTERN

        static final java.util.regex.Pattern UNIX_CMD_OUT_PATTERN
        The etime is in the form of [[dd-]hh:]mm:ss on Unix like systems. See the workaround https://issues.apache.org/jira/browse/SUREFIRE-1451.
      • BUSYBOX_CMD_OUT_PATTERN

        static final java.util.regex.Pattern BUSYBOX_CMD_OUT_PATTERN
      • ppid

        private final java.lang.String ppid
      • parentProcessInfo

        private volatile ProcessInfo parentProcessInfo
      • stopped

        private volatile boolean stopped
    • Constructor Detail

      • PpidChecker

        PpidChecker​(@Nonnull
                    java.lang.String ppid)
    • Method Detail

      • canUse

        boolean canUse()
      • isProcessAlive

        boolean isProcessAlive()
        This method can be called only after canUse() has returned true.
        Returns:
        true if parent process is alive; false otherwise
        Throws:
        java.lang.IllegalStateException - if canUse() returns false, error to read process or this object has been destroyed
        java.lang.NullPointerException - if extracted e-time is null
      • checkProcessInfo

        private void checkProcessInfo()
      • destroyActiveCommands

        void destroyActiveCommands()
      • isStopped

        private boolean isStopped()
      • unixPathToPS

        private static java.lang.String unixPathToPS()
      • canExecuteUnixPs

        static boolean canExecuteUnixPs()
      • canExecuteLocalUnixPs

        private static boolean canExecuteLocalUnixPs()
      • canExecuteStandardUnixPs

        private static boolean canExecuteStandardUnixPs()
      • hasWmicStandardSystemPath

        private static boolean hasWmicStandardSystemPath()
      • fromDays

        static long fromDays​(java.util.regex.Matcher matcher)
      • fromHours

        static long fromHours​(java.util.regex.Matcher matcher)
      • fromMinutes

        static long fromMinutes​(java.util.regex.Matcher matcher)
      • fromSeconds

        static long fromSeconds​(java.util.regex.Matcher matcher)
      • fromPID

        static java.lang.String fromPID​(java.util.regex.Matcher matcher)
      • fromBusyboxHours

        static long fromBusyboxHours​(java.util.regex.Matcher matcher)
      • fromBusyboxMinutes

        static long fromBusyboxMinutes​(java.util.regex.Matcher matcher)
      • fromBusyboxPID

        static java.lang.String fromBusyboxPID​(java.util.regex.Matcher matcher)
      • checkValid

        private static void checkValid​(java.util.Scanner scanner)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • createWindowsCreationDateFormat

        private static java.text.SimpleDateFormat createWindowsCreationDateFormat()
        The beginning part of Windows WMIC format yyyymmddHHMMSS.xxx
        https://technet.microsoft.com/en-us/library/ee198928.aspx
        We use UTC time zone which avoids DST changes, see SUREFIRE-1512.
        Returns:
        Windows WMIC format yyyymmddHHMMSS.xxx
      • stop

        public void stop()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object