public class MonitorUtils
extends java.lang.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 java.lang.Process |
exec(java.lang.String cmd) |
static int |
findOwnPid() |
static MonitorUtils.MemoryUsage |
getMemoryUsage(int pid) |
static MonitorUtils.MemoryUsage |
getMemoryUsage(int pid,
java.lang.String clazzRegexOfInterest,
int minInstancesOfInterest) |
static java.util.List<java.lang.Integer> |
getRunningPids(java.lang.String regex) |
static java.util.List<java.lang.Integer> |
getRunningPids(java.lang.String regex,
java.lang.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,
java.lang.String regex)
Confirm the given pid is running, and that the the process matches the given regex.
|
static boolean |
isUrlUp(java.net.URL url)
Confirm can read from URL.
|
static java.util.List<java.lang.String> |
searchLog(java.io.File file,
java.lang.String grepOfInterest) |
static java.util.List<java.lang.String> |
searchLog(java.io.File file,
java.lang.String grepOfInterest,
java.util.Set<java.lang.String> grepExclusions)
Find lines in the given file that match given given regex.
|
static java.lang.String |
waitFor(java.lang.Process process)
Waits for the given process to complete, consuming its stdout and returning it as a string.
|
public static boolean isUrlUp(java.net.URL url)
url - public static boolean isPidRunning(int pid)
public static boolean isPidRunning(int pid,
java.lang.String regex)
pid - regex - public static java.util.List<java.lang.Integer> getRunningPids(java.lang.String regex)
public static java.util.List<java.lang.Integer> getRunningPids(java.lang.String regex,
java.lang.String excludingRegex)
regex - excludingRegex - public static MonitorUtils.MemoryUsage getMemoryUsage(int pid)
public static MonitorUtils.MemoryUsage getMemoryUsage(int pid, java.lang.String clazzRegexOfInterest, int minInstancesOfInterest)
pid - public static java.util.List<java.lang.String> searchLog(java.io.File file,
java.lang.String grepOfInterest)
public static java.util.List<java.lang.String> searchLog(java.io.File file,
java.lang.String grepOfInterest,
java.util.Set<java.lang.String> grepExclusions)
file - grepOfInterest - public static java.lang.Process exec(java.lang.String cmd)
public static java.lang.String waitFor(java.lang.Process process)
public static int findOwnPid()
throws java.io.IOException
java.io.IOException