Package org.apache.maven.surefire.booter
Class PpidChecker
- java.lang.Object
-
- org.apache.maven.surefire.booter.PpidChecker
-
final class PpidChecker extends java.lang.ObjectRecognizes PID of Plugin process and determines lifetime.- Since:
- 2.20.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classPpidChecker.ProcessInfoConsumerReads standard output fromProcess.
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.regex.PatternBUSYBOX_CMD_OUT_PATTERNprivate java.util.Queue<java.lang.Process>destroyableCommandsprivate static intMINUTES_TO_MILLISprivate ProcessInfoparentProcessInfoprivate java.lang.Stringppidprivate static java.lang.StringPS_ETIME_HEADERprivate static java.lang.StringPS_PID_HEADERprivate static java.lang.StringRELATIVE_PATH_TO_WMICprivate booleanstoppedprivate static java.lang.StringSYSTEM_PATH_TO_WMIC(package private) static java.util.regex.PatternUNIX_CMD_OUT_PATTERNThe etime is in the form of [[dd-]hh:]mm:ss on Unix like systems.private static java.lang.StringWINDOWS_SYSTEM_ROOT_ENVprivate static java.lang.StringWMIC_CREATION_DATEprivate static java.text.SimpleDateFormatWMIC_CREATION_DATE_FORMATprivate static intWMIC_CREATION_DATE_TIMESTAMP_LENGTHprivate static intWMIC_CREATION_DATE_VALUE_LENGTH
-
Constructor Summary
Constructors Constructor Description PpidChecker(java.lang.String ppid)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleancanExecuteLocalUnixPs()private static booleancanExecuteStandardUnixPs()(package private) static booleancanExecuteUnixPs()(package private) booleancanUse()private voidcheckProcessInfo()private static voidcheckValid(java.util.Scanner scanner)private static java.text.SimpleDateFormatcreateWindowsCreationDateFormat()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.(package private) voiddestroyActiveCommands()(package private) static longfromBusyboxHours(java.util.regex.Matcher matcher)(package private) static longfromBusyboxMinutes(java.util.regex.Matcher matcher)(package private) static java.lang.StringfromBusyboxPID(java.util.regex.Matcher matcher)(package private) static longfromDays(java.util.regex.Matcher matcher)(package private) static longfromHours(java.util.regex.Matcher matcher)(package private) static longfromMinutes(java.util.regex.Matcher matcher)(package private) static java.lang.StringfromPID(java.util.regex.Matcher matcher)(package private) static longfromSeconds(java.util.regex.Matcher matcher)private static booleanhasWmicStandardSystemPath()(package private) booleanisProcessAlive()This method can be called only aftercanUse()has returnedtrue.private booleanisStopped()voidstop()java.lang.StringtoString()(package private) ProcessInfounix()private static java.lang.StringunixPathToPS()(package private) ProcessInfowindows()
-
-
-
Field Detail
-
MINUTES_TO_MILLIS
private static final int MINUTES_TO_MILLIS
- See Also:
- Constant Field Values
-
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
-
PS_ETIME_HEADER
private static final java.lang.String PS_ETIME_HEADER
- See Also:
- Constant Field Values
-
PS_PID_HEADER
private static final java.lang.String PS_PID_HEADER
- 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
-
-
Method Detail
-
canUse
boolean canUse()
-
isProcessAlive
boolean isProcessAlive()
This method can be called only aftercanUse()has returnedtrue.
-
checkProcessInfo
private void checkProcessInfo()
-
unix
ProcessInfo unix()
-
windows
ProcessInfo windows()
-
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:
toStringin classjava.lang.Object
-
-