Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.contrib.failmon
Class PersistentState

    java.lang.Object
      org.apache.hadoop.contrib.failmon.PersistentState

    public class PersistentState

extends Object

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

### PersistentState

    public PersistentState()

Method Detail

### readState

    public static void readState(String fname)

  Read the state of parsing for all open log files from a property file.

  Parameters:
    `fname` - the filename of the property file to be read

### getState

    public static org.apache.hadoop.contrib.failmon.ParseState getState(String fname)

  Read and return the state of parsing for a particular log file.

  Parameters:
    `fname` - the log file for which to read the state

### setState

    public static void setState(org.apache.hadoop.contrib.failmon.ParseState state)

  Set the state of parsing for a particular log file.

  Parameters:
    `state` - the ParseState to set

### updateState

    public static void updateState(String filename,
                                   String firstLine,
                                   long offset)

  Upadate the state of parsing for a particular log file.

  Parameters:
    `filename` - the log file for which to update the state
    `firstLine` - the first line of the log file currently
    `offset` - the byte offset of the last character parsed

### writeState

    public static void writeState(String fname)

  Write the state of parsing for all open log files to a property file on disk.

  Parameters:
    `fname` - the filename of the property file to write to

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation