|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.contrib.failmon.Environment
public class Environment
This class provides various methods for interaction with the configuration and the operating system environment. Also provides some helper methods for use by other classes in the package.
Field Summary | |
---|---|
static int |
DEFAULT_LOG_INTERVAL
|
static int |
DEFAULT_POLL_INTERVAL
|
static org.apache.commons.logging.Log |
LOG
|
static int |
MAX_OUTPUT_LENGTH
|
static int |
MIN_INTERVAL
|
Constructor Summary | |
---|---|
Environment()
|
Method Summary | |
---|---|
static boolean |
checkExistence(String cmd)
Checks whether a specific shell command is available in the system. |
static int |
gcd(int[] numbers)
Determines the greatest common divisor (GCD) of a list of integers. |
static int |
gcd(int m,
int n)
Determines the greatest common divisor (GCD) of two integers. |
static int |
getInterval(ArrayList<MonitorJob> monitors)
Determines the minimum interval at which the executor thread needs to wake upto execute jobs. |
static ArrayList<MonitorJob> |
getJobs()
Scans the configuration file to determine which monitoring utilities are available in the system. |
static String |
getProperty(String key)
Fetches the value of a property from the configuration file. |
static void |
logInfo(String str)
|
static void |
prepare(String fname)
Initializes structures needed by other methods. |
static StringBuffer |
runCommand(String cmd)
Runs a shell command in the system and provides a StringBuffer with the output of the command. |
static StringBuffer |
runCommand(String[] cmd)
Runs a shell command in the system and provides a StringBuffer with the output of the command. |
static void |
setProperty(String key,
String value)
Sets the value of a property inthe configuration file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_LOG_INTERVAL
public static final int DEFAULT_POLL_INTERVAL
public static int MIN_INTERVAL
public static final int MAX_OUTPUT_LENGTH
public static org.apache.commons.logging.Log LOG
Constructor Detail |
---|
public Environment()
Method Detail |
---|
public static void prepare(String fname)
public static String getProperty(String key)
key
- the name of the property
public static void setProperty(String key, String value)
key
- the name of the propertyvalue
- the new value for the propertypublic static ArrayList<MonitorJob> getJobs()
public static int getInterval(ArrayList<MonitorJob> monitors)
monitors
- the list of scheduled jobs
public static boolean checkExistence(String cmd)
cmd
- the command to check against
public static StringBuffer runCommand(String[] cmd)
cmd
- an array of string that form the command to run
public static StringBuffer runCommand(String cmd)
cmd
- the command to run
public static int gcd(int m, int n)
m
- the first integern
- the second integer
public static int gcd(int[] numbers)
numbers
- the list of integers to process
public static void logInfo(String str)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |