org.apache.hadoop.chukwa.datacollection.adaptor.filetailer
Class CharFileTailingAdaptorUTF8

java.lang.Object
  extended by org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
      extended by org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
          extended by org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.FileTailingAdaptor
              extended by org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.CharFileTailingAdaptorUTF8
All Implemented Interfaces:
Adaptor

public class CharFileTailingAdaptorUTF8
extends FileTailingAdaptor

A subclass of FileTailingAdaptor that reads UTF8/ascii files and splits records at carriage returns.


Field Summary
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.FileTailingAdaptor
GRACEFUL_PERIOD, MAX_RETRIES, reader
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
conf, DEFAULT_MAX_READ_SIZE, fileReadOffset, MAX_READ_SIZE, MAX_READ_SIZE_OPT, offsetOfFirstByte, tailer
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
adaptorID, control, dest, type
 
Constructor Summary
CharFileTailingAdaptorUTF8()
           
 
Method Summary
protected  int extractRecords(ChunkReceiver eq, long buffOffsetInFile, byte[] buf)
          Note: this method uses a temporary ArrayList (shared across instances).
 
Methods inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.FileTailingAdaptor
shutdown, start, tailFile
 
Methods inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
getCurrentStatus, getStreamName, parseArgs, slurp, toString
 
Methods inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
deregisterAndStop, getType, hardStop, parseArgs, shutdown, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CharFileTailingAdaptorUTF8

public CharFileTailingAdaptorUTF8()
Method Detail

extractRecords

protected int extractRecords(ChunkReceiver eq,
                             long buffOffsetInFile,
                             byte[] buf)
                      throws InterruptedException
Note: this method uses a temporary ArrayList (shared across instances). This means we're copying ints each time. This could be a performance issue. Also, 'offsets' never shrinks, and will be of size proportional to the largest number of lines ever seen in an event.

Overrides:
extractRecords in class LWFTAdaptor
Parameters:
eq - the queue to stick the new chunk[s] in
buffOffsetInFile - the byte offset in the stream at which buf[] begins
buf - the byte buffer to extract records from
Returns:
the number of bytes processed
Throws:
InterruptedException


Copyright © ${year} The Apache Software Foundation