Package org.apache.maven.surefire.booter
Class PpidChecker
java.lang.Object
org.apache.maven.surefire.booter.PpidChecker
Recognizes PID of Plugin process and determines lifetime.
- Since:
- 2.20.1
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Pattern
private static final long
private ProcessInfo
private final String
private static final String
private static final String
private static final String
private boolean
private static final String
(package private) static final Pattern
The etime is in the form of [[dd-]hh:]mm:ss on Unix like systems.private static final String
private static final String
private static final SimpleDateFormat
private static final int
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
private static boolean
(package private) static boolean
(package private) boolean
canUse()
private void
private static void
checkValid
(Scanner scanner) private static SimpleDateFormat
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) void
(package private) static long
fromBusyboxHours
(Matcher matcher) (package private) static long
fromBusyboxMinutes
(Matcher matcher) (package private) static String
fromBusyboxPID
(Matcher matcher) (package private) static long
(package private) static long
(package private) static long
fromMinutes
(Matcher matcher) (package private) static String
(package private) static long
fromSeconds
(Matcher matcher) private static boolean
(package private) boolean
This method can be called only aftercanUse()
has returnedtrue
.(package private) boolean
void
stop()
toString()
(package private) ProcessInfo
unix()
private static String
(package private) ProcessInfo
windows()
-
Field Details
-
MINUTES_TO_MILLIS
private static final long MINUTES_TO_MILLIS- See Also:
-
WMIC_CREATION_DATE_VALUE_LENGTH
private static final int WMIC_CREATION_DATE_VALUE_LENGTH- See Also:
-
WMIC_CREATION_DATE_TIMESTAMP_LENGTH
private static final int WMIC_CREATION_DATE_TIMESTAMP_LENGTH- See Also:
-
WMIC_CREATION_DATE_FORMAT
-
WMIC_CREATION_DATE
- See Also:
-
WINDOWS_SYSTEM_ROOT_ENV
- See Also:
-
RELATIVE_PATH_TO_WMIC
- See Also:
-
SYSTEM_PATH_TO_WMIC
- See Also:
-
PS_ETIME_HEADER
- See Also:
-
PS_PID_HEADER
- See Also:
-
destroyableCommands
-
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
-
ppid
-
parentProcessInfo
-
stopped
private volatile boolean stopped
-
-
Constructor Details
-
PpidChecker
PpidChecker(@Nonnull String ppid)
-
-
Method Details
-
canUse
boolean canUse() -
isProcessAlive
boolean isProcessAlive()This method can be called only aftercanUse()
has returnedtrue
.- Returns:
true
if parent process is alive;false
otherwise- Throws:
IllegalStateException
- ifcanUse()
returnsfalse
, error to read process or this object has beendestroyed
NullPointerException
- if extracted e-time is null
-
checkProcessInfo
private void checkProcessInfo() -
unix
ProcessInfo unix() -
windows
ProcessInfo windows() -
destroyActiveCommands
void destroyActiveCommands() -
isStopped
boolean isStopped() -
unixPathToPS
-
canExecuteUnixPs
static boolean canExecuteUnixPs() -
canExecuteLocalUnixPs
private static boolean canExecuteLocalUnixPs() -
canExecuteStandardUnixPs
private static boolean canExecuteStandardUnixPs() -
hasWmicStandardSystemPath
private static boolean hasWmicStandardSystemPath() -
fromDays
-
fromHours
-
fromMinutes
-
fromSeconds
-
fromPID
-
fromBusyboxHours
-
fromBusyboxMinutes
-
fromBusyboxPID
-
checkValid
- Throws:
IOException
-
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
-