|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.contrib.failmon.PersistentState
public class PersistentState
This class takes care of the information that needs to be persistently stored locally on nodes. Bookkeeping is done for the state of parsing of log files, so that the portion of the file that has already been parsed in previous calls will not be parsed again. For each log file, we maintain the byte offset of the last character parsed in previous passes. Also, the first entry in the log file is stored, so that FailMon can determine when a log file has been rotated (and thus parsing needs to start from the beginning of the file). We use a property file to store that information. For each log file we create a property keyed by the filename, the value of which contains the byte offset and first log entry separated by a SEPARATOR.
Constructor Summary | |
---|---|
PersistentState()
|
Method Summary | |
---|---|
static org.apache.hadoop.contrib.failmon.ParseState |
getState(String fname)
Read and return the state of parsing for a particular log file. |
static void |
readState(String fname)
Read the state of parsing for all open log files from a property file. |
static void |
setState(org.apache.hadoop.contrib.failmon.ParseState state)
Set the state of parsing for a particular log file. |
static void |
updateState(String filename,
String firstLine,
long offset)
Upadate the state of parsing for a particular log file. |
static void |
writeState(String fname)
Write the state of parsing for all open log files to a property file on disk. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PersistentState()
Method Detail |
---|
public static void readState(String fname)
fname
- the filename of the property file to be readpublic static org.apache.hadoop.contrib.failmon.ParseState getState(String fname)
fname
- the log file for which to read the statepublic static void setState(org.apache.hadoop.contrib.failmon.ParseState state)
state
- the ParseState to setpublic static void updateState(String filename, String firstLine, long offset)
filename
- the log file for which to update the statefirstLine
- the first line of the log file currentlyoffset
- the byte offset of the last character parsedpublic static void writeState(String fname)
fname
- the filename of the property file to write to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |