public class MonitorUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MonitorUtils.MemoryUsage |
static class |
MonitorUtils.ProcessHasStderr |
| Constructor and Description |
|---|
MonitorUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Process |
exec(String cmd) |
static int |
findOwnPid() |
static MonitorUtils.MemoryUsage |
getMemoryUsage(int pid) |
static MonitorUtils.MemoryUsage |
getMemoryUsage(int pid,
String clazzRegexOfInterest,
int minInstancesOfInterest) |
static List<Integer> |
getRunningPids(String regex) |
static List<Integer> |
getRunningPids(String regex,
String excludingRegex)
Confirm the given pid is running, and that the the process matches the given regex.
|
static boolean |
isPidRunning(int pid) |
static boolean |
isPidRunning(int pid,
String regex)
Confirm the given pid is running, and that the the process matches the given regex.
|
static boolean |
isUrlUp(URL url)
Confirm can read from URL.
|
static List<String> |
searchLog(File file,
String grepOfInterest) |
static List<String> |
searchLog(File file,
String grepOfInterest,
Set<String> grepExclusions)
Find lines in the given file that match given given regex.
|
static String |
waitFor(Process process)
Waits for the given process to complete, consuming its stdout and returning it as a string.
|
public static boolean isUrlUp(URL url)
url - public static boolean isPidRunning(int pid)
public static boolean isPidRunning(int pid,
String regex)
pid - regex - public static List<Integer> getRunningPids(String regex, String excludingRegex)
regex - excludingRegex - public static MonitorUtils.MemoryUsage getMemoryUsage(int pid)
public static MonitorUtils.MemoryUsage getMemoryUsage(int pid, String clazzRegexOfInterest, int minInstancesOfInterest)
pid - public static List<String> searchLog(File file, String grepOfInterest, Set<String> grepExclusions)
file - grepOfInterest - public static String waitFor(Process process)
public static int findOwnPid()
throws IOException
IOExceptionCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.