org.apache.hadoop.chukwa.datacollection.writer
Class SeqFileWriter

java.lang.Object
  extended by org.apache.hadoop.chukwa.datacollection.writer.SeqFileWriter
All Implemented Interfaces:
ChukwaWriter

public class SeqFileWriter
extends Object
implements ChukwaWriter

This class is thread-safe -- rotate() and save() both synchronize on this object.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.chukwa.datacollection.writer.ChukwaWriter
ChukwaWriter.COMMIT_PENDING, ChukwaWriter.CommitStatus
 
Field Summary
protected  org.apache.hadoop.fs.FSDataOutputStream currentOutputStr
           
static boolean ENABLE_ROTATION_ON_CLOSE
           
protected  boolean isRunning
           
static String OUTPUT_DIR_OPT
           
static String ROTATE_INTERVAL_OPT
           
protected  Timer rotateTimer
           
static String STAT_PERIOD_OPT
           
protected  Timer statTimer
           
 
Fields inherited from interface org.apache.hadoop.chukwa.datacollection.writer.ChukwaWriter
COMMIT_FAIL, COMMIT_OK
 
Constructor Summary
SeqFileWriter()
           
 
Method Summary
 ChukwaWriter.CommitStatus add(List<Chunk> chunks)
          Called repeatedly with data that should be serialized.
 void close()
          Called once, indicating that the writer should close files and prepare to exit.
protected  void computeTimePeriod()
           
 long getBytesWritten()
           
 void init(org.apache.hadoop.conf.Configuration conf)
          Called once to initialize this writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLE_ROTATION_ON_CLOSE

public static boolean ENABLE_ROTATION_ON_CLOSE

STAT_PERIOD_OPT

public static final String STAT_PERIOD_OPT
See Also:
Constant Field Values

ROTATE_INTERVAL_OPT

public static final String ROTATE_INTERVAL_OPT
See Also:
Constant Field Values

OUTPUT_DIR_OPT

public static final String OUTPUT_DIR_OPT
See Also:
Constant Field Values

currentOutputStr

protected org.apache.hadoop.fs.FSDataOutputStream currentOutputStr

rotateTimer

protected Timer rotateTimer

statTimer

protected Timer statTimer

isRunning

protected volatile boolean isRunning
Constructor Detail

SeqFileWriter

public SeqFileWriter()
Method Detail

getBytesWritten

public long getBytesWritten()

init

public void init(org.apache.hadoop.conf.Configuration conf)
          throws WriterException
Description copied from interface: ChukwaWriter
Called once to initialize this writer.

Specified by:
init in interface ChukwaWriter
Throws:
WriterException

computeTimePeriod

protected void computeTimePeriod()

add

public ChukwaWriter.CommitStatus add(List<Chunk> chunks)
                              throws WriterException
Description copied from interface: ChukwaWriter
Called repeatedly with data that should be serialized. Subclasses may assume that init() will be called before any calls to add(), and that add() won't be called after close().

Specified by:
add in interface ChukwaWriter
Returns:
Throws:
WriterException

close

public void close()
Description copied from interface: ChukwaWriter
Called once, indicating that the writer should close files and prepare to exit.

Specified by:
close in interface ChukwaWriter


Copyright © ${year} The Apache Software Foundation