Package jetbrains.buildServer.processes
Class ProcessTreeTerminator
- java.lang.Object
-
- jetbrains.buildServer.processes.ProcessTreeTerminator
-
public abstract class ProcessTreeTerminator extends Object
- Author:
- Kir, Eugene Petrenko
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_COMMAND_DELAY
static org.apache.log4j.Logger
LOG
static String
TEMP_PATH_SYSTEM_PROPERTY
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProcessTreeTerminator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collection<ProcessNode>
getChildProcesses(Long pid, ProcessFilter filter)
Returns child processes of the process specified by rge pid matched by the specified filterstatic Collection<ProcessNode>
getChildProcesses(ProcessFilter filter)
Returns child processes matched by the specified filterstatic long
getCurrentPid()
Gets current process's pid.static void
init()
Initializes process tree terminatorstatic boolean
kill(Long pid, KillProcessDetails killProcessDetails)
Kills process specified by pid and it's subprocesses matched by specified filter.static boolean
kill(KillProcessDetails killProcessDetails)
Kills child processes matched by specified filter.
-
-
-
Field Detail
-
LOG
public static final org.apache.log4j.Logger LOG
-
DEFAULT_COMMAND_DELAY
protected static final int DEFAULT_COMMAND_DELAY
- See Also:
- Constant Field Values
-
TEMP_PATH_SYSTEM_PROPERTY
public static final String TEMP_PATH_SYSTEM_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init()
Initializes process tree terminator
-
kill
public static boolean kill(@Nullable Long pid, KillProcessDetails killProcessDetails)
Kills process specified by pid and it's subprocesses matched by specified filter. If pid parameter is null, kills current process's subtree. Avoids killing current process- Parameters:
pid
- process pidkillProcessDetails
- kill process details- Returns:
- should return the actual status if the process was killed, but current implementation may return true even if the process was not killed.
-
kill
public static boolean kill(KillProcessDetails killProcessDetails)
Kills child processes matched by specified filter.- Parameters:
killProcessDetails
- kill process details- Returns:
- should return the actual status if the process was killed, but the current implementation may return true even if the process was not killed.
-
getChildProcesses
public static Collection<ProcessNode> getChildProcesses(@Nullable Long pid, @NotNull ProcessFilter filter)
Returns child processes of the process specified by rge pid matched by the specified filter- Parameters:
filter
- process filter- Returns:
- collection of child processes
-
getChildProcesses
public static Collection<ProcessNode> getChildProcesses(@NotNull ProcessFilter filter)
Returns child processes matched by the specified filter- Parameters:
filter
- process filter- Returns:
- collection of child processes
-
getCurrentPid
public static long getCurrentPid()
Gets current process's pid. This operation may take appreciable timed ue to process tree rebuild- Returns:
- process pid
-
-