public class WindowsProcessManager extends AbstractProcessManager
ProcessManager implementation for Windows.
Requires wmic.exe and taskkill.exe, that should be available at least on Windows XP, Windows Vista, and Windows 7 (except Home versions).
PID_NOT_FOUND, PID_UNKNOWN| Constructor and Description |
|---|
WindowsProcessManager() |
| Modifier and Type | Method and Description |
|---|---|
static WindowsProcessManager |
getDefault()
Gets the default instance of
WindowsProcessManager. |
protected String[] |
getRunningProcessesCommand(String process)
Gets the command to be executed to get a snapshot of all the running processes identified by
the specified argument (process).
|
protected Pattern |
getRunningProcessLinePattern()
Gets the pattern to be used to match an output line containing the information about a running
process.
|
boolean |
isUsable()
Gets whether the commands we need are available for a Windows OS.
|
void |
kill(Process process,
long pid)
Kills the specified process.
|
execute, findPidpublic static WindowsProcessManager getDefault()
WindowsProcessManager.WindowsProcessManager instance.protected String[] getRunningProcessesCommand(String process)
AbstractProcessManagergetRunningProcessesCommand in class AbstractProcessManagerprocess - The name of the process to query for.protected Pattern getRunningProcessLinePattern()
AbstractProcessManagergetRunningProcessLinePattern in class AbstractProcessManagerAbstractProcessManager.getRunningProcessesCommand(String)public boolean isUsable()
true If the required commands are available, false otherwise.public void kill(Process process, long pid) throws IOException
ProcessManagerprocess - The process to kill.pid - The id of the process to kill.IOException - If an IO error occurs.